Main»Dog

Dog

Dog - D OpenGL is a wrapper library for the OpenGL API, along with an OS-level window creating backend and an interface to extensions.

TODO: more info

When a GL context is acquired, it may be used for rendering. This differs from most OpenGL wrappers which use the default C functions. For instance, having an instance of GL called gl, OpenGL API calls are done like:

gl.Begin(GL_TRIANGLES);
gl.Vertex3f(....);

instead of the usual

glBegin(GL_TRIANGLES);
glVertex3f(....);

This may look like a serious heresy, but thanks to this approach, Dog may e.g. automatically restrict access to a single rendering context to a single thread. It also means that rendering operations are better contained and aren't likely to occur in the middle of e.g. logging functions. To perform any rendering, a particular code block needs to get a valid GL handle.

Moreover, it allows each GL handle to have its own set of OpenGL extension pointers. For instance, in MS Windows, OpenGL drivers may return different extension implementations for different rendering contexts. With Dog, it's all transparent to the user.