opengl

Topics related to opengl:

Getting started with opengl

OpenGL is an open standard for rendering 2D and 3D graphics leveraging graphics hardware. OpenGL has been implemented across a stunning array of platforms allowing apps targeting OpenGL to be extremely flexible.

Texturing

3d Math

Basic Lighting

Shaders

OpenGL context creation.

Framebuffers

Encapsulating OpenGL objects with C++ RAII

RAII encapsulation of OpenGL objects has dangers. The most unavoidable is that OpenGL objects are associated with the OpenGL context that created them. So the destruction of a C++ RAII object must be done in a OpenGL context which shares ownership of the OpenGL object managed by that C++ object.

This also means that if all contexts which own the object are destroyed, then any existing RAII encapsulated OpenGL objects will try to destroy objects which no longer exist.

You must take manual steps to deal with context issues like this.

Instancing

Shader Loading and Compilation

Shader objects, as created from glCreateShader do not do much. They contain the compiled code for a single stage, but they do not even have to contain the complete compiled code for that stage. In many ways, they work like C and C++ object files.

Program objects contain the final linked program. But they also hold the state for the program's uniform values, as well as a number of other state data. They have APIs for introspecting the shader's interface data (though it only became comprehensive in GL 4.3). Program objects are what defines the shader code that you use when rendering.

Shader objects, once used to link a program, are no longer needed unless you intend to use them to link other programs.

Using VAOs

The separate attribute format VAO setup can interoperate with glVertexAttribPointer (the latter is defined in terms of the former). But you must be careful when doing so.

The separate attribute format version have direct state access (DSA) equivalents in 4.5. These will have the same parameters but instead of using the bound VAO, the VAO being modified is passed explicitly. When using DSA de index buffer for glDrawElements can be set with glVertexArrayElementBuffer(vao, ebo);

OGL view and projection

Program Introspection