Gamedev Framework (gf)  0.1.0
A C++11 framework for 2D games
OpenGL in gf

Table of Contents

Why OpenGL ES 2.0?

Gamedev Framework is based on Open GL ES 2.0. This choice is motivated by the following facts:

Conventions

Textures

In OpenGL, texture data should be uploaded beginning with the lower left corner. In gf, textures are uploaded beginning with the upper left corner, meaning that they are horizontally flipped in graphical memory. This is not a problem.

Indeed, texture coordinates normally range from \( 0 \) to \( 1 \), \( (0,0) \) being the lower left corner. In gf, the convention is that \( (0,0) \) represents the upper left corner, which is more intuitive for a graphical application.

See also
glTexImage2D, open.gl: Textures objects and parameters

Matrices

In OpenGL, matrices are defined in column major order. In gf, gf::Matrix is defined in row major order. So, when uploaded directly, the matrix is transposed. As a consequence, in the shader, instead of doing a matrix-vector multiplication, we have to do a vector-matrix multiplication and that's it.

See also
glUniformMatrix{2|3|4}fv, Stack Overflow: Using row-major in OpenGL shader