group graphics

Basic graphical functionality via OpenGL. More...

Classes

Type Name
struct ffw::Color
class ffw::GLException
class ffw::GLBuffer
class ffw::GLVertexBuffer
class ffw::GLElementBuffer
class ffw::GLCanvas
class ffw::GLFramebuffer
class ffw::GLProgram
class ffw::GLRenderbuffer
class ffw::GLRenderbuffer2D
class ffw::GLRenderbuffer2DMS
class ffw::GLRenderWindow
class ffw::GLShader
class ffw::GLTexture
class ffw::GLTexture1D
class ffw::GLTexture1DArray
class ffw::GLTexture2D
class ffw::GLTexture2DArray
class ffw::GLTexture2DArrayMS
class ffw::GLTexture2DMS
class ffw::GLTexture3D
class ffw::GLTextureCubemap
class ffw::GLVertexArray
struct ffw::Mat3x3
struct ffw::Mat4x4
struct ffw::Monitor
struct ffw::Quaternion
class ffw::WindowException
struct ffw::RenderWindowArgs
class ffw::RenderWindow
struct ffw::Vec2
struct ffw::Vec3
struct ffw::Vec4

Typedefs

Type Name
typedef Mat3x3< float > Mat3x3f
typedef Mat3x3< double > Mat3x3d
typedef Mat3x3< int > Mat3x3i
typedef Mat4x4< float > Mat4x4f
typedef Mat4x4< double > Mat4x4d
typedef Mat4x4< int > Mat4x4i
typedef Quaternion< float > Quaternionf
typedef Quaternion< double > Quaterniond
typedef Vec2< float > Vec2f
typedef Vec2< int > Vec2i
typedef Vec2< short > Vec2s
typedef Vec2< long long > Vec2ll
typedef Vec2< double > Vec2d
typedef Vec3< float > Vec3f
typedef Vec3< int > Vec3i
typedef Vec3< short > Vec3s
typedef Vec3< long long > Vec3ll
typedef Vec3< double > Vec3d
typedef Vec4< float > Vec4f
typedef Vec4< int > Vec4i
typedef Vec4< short > Vec4s
typedef Vec4< long long > Vec4ll
typedef Vec4< double > Vec4d

Functions

Type Name
Color rgb (unsigned long hex)
Constructs ffw::Color from a hexadecimal value.
Color rgb (unsigned char r, unsigned char g, unsigned char b)
Constructs ffw::Color from three 8-bit balues.
Color rgba (unsigned long hex)
Constructs ffw::Color from a hexadecimal value with alpha.
Color rgba (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Constructs ffw::Color from three 8-bit balues with alpha.
Color hsl (const float h, const float s, const float l, const float a = 1.0f)
Constructs ffw::Color from HSL values.
Color hsv (const float h, const float s, const float v, const float a = 1.0f)
Constructs ffw::Color from HSV values.
ffw::Color normalize (const Color & col)
Normalizes a color returning a copy (won't modify the original)
ffw::Color clamp (const ffw::Color & color)
Clamps a color between 0.0 and 1.0 values returning a copy (won't modify the original)
std::ostream & operator<< (std::ostream & os, const ffw::Color & color)
void loadGlCoreArb (void *(*)(const char *) glextLoader)
T clamp (const T val, const T min, const T max)
T lerp (const T & a, const T & b, float w)
T radians (const T val)
T degrees (const T val)
T remap (const T value, const T inMin, const T inMax, const T outMin, const T outMax)
unsigned long nextPowOfTwo (const unsigned long value)
unsigned short byteSwap16 (const unsigned short value)
unsigned long byteSwap32 (const unsigned long value)
unsigned long long byteSwap64 (const unsigned long long value)
ffw::Mat4x4< T > makeRotationMatrix (const ffw::Quaternion< T > & q)
Mat4x4< T > makeProjectionMatrix (T fieldOfView, T aspect, T near, T far)
Mat4x4< T > makeLookAtMatrix (const Vec3< T > & eyes, const Vec3< T > & target, const Vec3< T > & upVector)
Mat4x4< T > makeFpsCameraMatrix (const Vec3< T > & eyes, float pitch, float yaw)
Mat4x4< T > makeOrthoMatrix (T left, T right, T bottom, T top, T znear, T zfar)
ffw::Quaternion< T > normalize (const Quaternion< T > & q)
std::ostream & operator<< (std::ostream & os, const ffw::Quaternion< T > & quat)
T dot (const ffw::Vec2< T > & v1, const ffw::Vec2< T > & v2)
T distance (const Vec2< T > & v1, const Vec2< T > & v2)
Vec2< T > middle (const Vec2< T > & v1, const Vec2< T > & v2)
ffw::Vec2< T > normalize (const Vec2< T > & vec)
double angle (const ffw::Vec2< T > & v1, const ffw::Vec2< T > & v2)
double angleRad (const ffw::Vec2< T > & v1, const ffw::Vec2< T > & v2)
std::ostream & operator<< (std::ostream & os, const ffw::Vec2< T > & vec)
T dot (const ffw::Vec3< T > & v1, const ffw::Vec3< T > & v2)
ffw::Vec3< T > cross (const ffw::Vec3< T > & v1, const ffw::Vec3< T > & v2)
T distance (const Vec3< T > & v1, const Vec3< T > & v2)
Vec3< T > middle (const Vec3< T > & v1, const Vec3< T > & v2)
ffw::Vec3< T > normalize (const Vec3< T > & vec)
double angle (const ffw::Vec3< T > & v1, const ffw::Vec3< T > & v2)
double angleRad (const ffw::Vec3< T > & v1, const ffw::Vec3< T > & v2)
std::ostream & operator<< (std::ostream & os, const ffw::Vec3< T > & vec)
T dot (const ffw::Vec4< T > & V1, const ffw::Vec4< T > & V2)
T distance (const Vec4< T > & v1, const Vec4< T > & v2)
Vec4< T > middle (const Vec4< T > & v1, const Vec4< T > & v2)
ffw::Vec4< T > normalize (const Vec4< T > & vec)
std::ostream & operator<< (std::ostream & os, const ffw::Vec4< T > & vec)
T dot (const ffw::Vec< T, S > & V1, const ffw::Vec< T, S > & V2)
T distance (const Vec< T, S > & v1, const Vec< T, S > & v2)
Vec< T, S > middle (const Vec< T, S > & v1, const Vec< T, S > & v2)
ffw::Vec< T, S > normalize (const Vec< T, S > & vec)
std::ostream & operator<< (std::ostream & os, const ffw::Vec< T, S > & vec)

Detailed Description

This module contains the basic API wrappers around OpenGL (such as textures, framebuffers, renderbuffers), Window management and user input handling in easy to follow wrapper class using GLFW as the backend. This module also contains basic drawing API using nanovg library, for drawing bitmap fonts, true type fonts, shapes, and textures. Uses the following third party libraries: GLFW, FreeType, libpng, libz, and nanovg

Typedefs Documentation

typedef Mat3x3f

typedef Mat3x3<float> ffw::Mat3x3f;

typedef Mat3x3d

typedef Mat3x3<double> ffw::Mat3x3d;

typedef Mat3x3i

typedef Mat3x3<int> ffw::Mat3x3i;

typedef Mat4x4f

typedef Mat4x4<float> ffw::Mat4x4f;

typedef Mat4x4d

typedef Mat4x4<double> ffw::Mat4x4d;

typedef Mat4x4i

typedef Mat4x4<int> ffw::Mat4x4i;

typedef Quaternionf

typedef Quaternion<float> ffw::Quaternionf;

typedef Quaterniond

typedef Quaternion<double> ffw::Quaterniond;

typedef Vec2f

typedef Vec2<float> ffw::Vec2f;

typedef Vec2i

typedef Vec2<int> ffw::Vec2i;

typedef Vec2s

typedef Vec2<short> ffw::Vec2s;

typedef Vec2ll

typedef Vec2<long long> ffw::Vec2ll;

typedef Vec2d

typedef Vec2<double> ffw::Vec2d;

typedef Vec3f

typedef Vec3<float> ffw::Vec3f;

typedef Vec3i

typedef Vec3<int> ffw::Vec3i;

typedef Vec3s

typedef Vec3<short> ffw::Vec3s;

typedef Vec3ll

typedef Vec3<long long> ffw::Vec3ll;

typedef Vec3d

typedef Vec3<double> ffw::Vec3d;

typedef Vec4f

typedef Vec4<float> ffw::Vec4f;

typedef Vec4i

typedef Vec4<int> ffw::Vec4i;

typedef Vec4s

typedef Vec4<short> ffw::Vec4s;

typedef Vec4ll

typedef Vec4<long long> ffw::Vec4ll;

typedef Vec4d

typedef Vec4<double> ffw::Vec4d;

Functions Documentation

function rgb

Color graphics::rgb (
    unsigned long hex
)

Constructs ffw::Color from a hexadecimal value.

For example, ffw::rgb(0xFF0080) returns 100% red and 50% blue. Alpha is set to 100%.

Warning:

Make sure to use 0xRRGGBB formula. For example, using 0xFF00 in this function would result of color with 0% red, 100% green, and 0% blue. Also, using 0xFF would result in complete blue color.

function rgb

Color graphics::rgb (
    unsigned char r,
    unsigned char g,
    unsigned char b
)

Constructs ffw::Color from three 8-bit balues.

For example, ffw::rgb(255, 0, 128) returns 100% red and 50% blue. Alpha is set to 100%.

function rgba

Color graphics::rgba (
    unsigned long hex
)

Constructs ffw::Color from a hexadecimal value with alpha.

For example, ffw::rgba(0xFF0080BF) returns 100% red, 50% blue, and 80% alpha.

Warning:

Make sure to use 0xRRGGBBAA formula. For example, using 0xFF0080 in this function would result of color with 0% red, 100% green, 0% blue, and 50% alpha. Also, using 0xFF would result in complete black color with 100% alpha.

function rgba

Color graphics::rgba (
    unsigned char r,
    unsigned char g,
    unsigned char b,
    unsigned char a
)

Constructs ffw::Color from three 8-bit balues with alpha.

For example, ffw::rgba(255, 0, 128, 191) returns 100% red, 50% blue, and 80% alpha.

function hsl

Color graphics::hsl (
    const float h,
    const float s,
    const float l,
    const float a = 1.0f
)

Constructs ffw::Color from HSL values.

Parameters:

  • h The hue component in range [0, 1]
  • s The saturation component in range [0, 1]
  • l The luminance component in range [0, 1]
  • a The alpha component in range [0, 1]

For example, ffw::hsl(0.8f, 0.5f, 0.5f) returns purple color with 50% saturation and 50% luminance.

function hsv

Color graphics::hsv (
    const float h,
    const float s,
    const float v,
    const float a = 1.0f
)

Constructs ffw::Color from HSV values.

Parameters:

  • h The hue component in range [0, 1]
  • s The saturation component in range [0, 1]
  • v The value component in range [0, 1]
  • a The alpha component in range [0, 1]

function normalize

ffw::Color graphics::normalize (
    const Color & col
)

Normalizes a color returning a copy (won't modify the original)

function clamp

ffw::Color graphics::clamp (
    const ffw::Color & color
)

Clamps a color between 0.0 and 1.0 values returning a copy (won't modify the original)

function operator<<

std::ostream & graphics::operator<< (
    std::ostream & os,
    const ffw::Color & color
)

function loadGlCoreArb

void graphics::loadGlCoreArb (
    void *(*)(const char *) glextLoader
)

function clamp

T graphics::clamp (
    const T val,
    const T min,
    const T max
)

function lerp

T graphics::lerp (
    const T & a,
    const T & b,
    float w
)

function radians

T graphics::radians (
    const T val
)

function degrees

T graphics::degrees (
    const T val
)

function remap

T graphics::remap (
    const T value,
    const T inMin,
    const T inMax,
    const T outMin,
    const T outMax
)

function nextPowOfTwo

unsigned long graphics::nextPowOfTwo (
    const unsigned long value
)

function byteSwap16

unsigned short graphics::byteSwap16 (
    const unsigned short value
)

function byteSwap32

unsigned long graphics::byteSwap32 (
    const unsigned long value
)

function byteSwap64

unsigned long long graphics::byteSwap64 (
    const unsigned long long value
)

function makeRotationMatrix

ffw::Mat4x4< T > graphics::makeRotationMatrix (
    const ffw::Quaternion< T > & q
)

function makeProjectionMatrix

Mat4x4< T > graphics::makeProjectionMatrix (
    T fieldOfView,
    T aspect,
    T near,
    T far
)

function makeLookAtMatrix

Mat4x4< T > graphics::makeLookAtMatrix (
    const Vec3< T > & eyes,
    const Vec3< T > & target,
    const Vec3< T > & upVector
)

function makeFpsCameraMatrix

Mat4x4< T > graphics::makeFpsCameraMatrix (
    const Vec3< T > & eyes,
    float pitch,
    float yaw
)

function makeOrthoMatrix

Mat4x4< T > graphics::makeOrthoMatrix (
    T left,
    T right,
    T bottom,
    T top,
    T znear,
    T zfar
)

function normalize

ffw::Quaternion< T > graphics::normalize (
    const Quaternion< T > & q
)

function operator<<

std::ostream & graphics::operator<< (
    std::ostream & os,
    const ffw::Quaternion< T > & quat
)

function dot

T graphics::dot (
    const ffw::Vec2< T > & v1,
    const ffw::Vec2< T > & v2
)

function distance

T graphics::distance (
    const Vec2< T > & v1,
    const Vec2< T > & v2
)

function middle

Vec2< T > graphics::middle (
    const Vec2< T > & v1,
    const Vec2< T > & v2
)

function normalize

ffw::Vec2< T > graphics::normalize (
    const Vec2< T > & vec
)

function angle

double graphics::angle (
    const ffw::Vec2< T > & v1,
    const ffw::Vec2< T > & v2
)

function angleRad

double graphics::angleRad (
    const ffw::Vec2< T > & v1,
    const ffw::Vec2< T > & v2
)

function operator<<

std::ostream & graphics::operator<< (
    std::ostream & os,
    const ffw::Vec2< T > & vec
)

function dot

T graphics::dot (
    const ffw::Vec3< T > & v1,
    const ffw::Vec3< T > & v2
)

function cross

ffw::Vec3< T > graphics::cross (
    const ffw::Vec3< T > & v1,
    const ffw::Vec3< T > & v2
)

function distance

T graphics::distance (
    const Vec3< T > & v1,
    const Vec3< T > & v2
)

function middle

Vec3< T > graphics::middle (
    const Vec3< T > & v1,
    const Vec3< T > & v2
)

function normalize

ffw::Vec3< T > graphics::normalize (
    const Vec3< T > & vec
)

function angle

double graphics::angle (
    const ffw::Vec3< T > & v1,
    const ffw::Vec3< T > & v2
)

function angleRad

double graphics::angleRad (
    const ffw::Vec3< T > & v1,
    const ffw::Vec3< T > & v2
)

function operator<<

std::ostream & graphics::operator<< (
    std::ostream & os,
    const ffw::Vec3< T > & vec
)

function dot

T graphics::dot (
    const ffw::Vec4< T > & V1,
    const ffw::Vec4< T > & V2
)

function distance

T graphics::distance (
    const Vec4< T > & v1,
    const Vec4< T > & v2
)

function middle

Vec4< T > graphics::middle (
    const Vec4< T > & v1,
    const Vec4< T > & v2
)

function normalize

ffw::Vec4< T > graphics::normalize (
    const Vec4< T > & vec
)

function operator<<

std::ostream & graphics::operator<< (
    std::ostream & os,
    const ffw::Vec4< T > & vec
)

function dot

T graphics::dot (
    const ffw::Vec< T, S > & V1,
    const ffw::Vec< T, S > & V2
)

function distance

T graphics::distance (
    const Vec< T, S > & v1,
    const Vec< T, S > & v2
)

function middle

Vec< T, S > graphics::middle (
    const Vec< T, S > & v1,
    const Vec< T, S > & v2
)

function normalize

ffw::Vec< T, S > graphics::normalize (
    const Vec< T, S > & vec
)

function operator<<

std::ostream & graphics::operator<< (
    std::ostream & os,
    const ffw::Vec< T, S > & vec
)