Archives: December 2012

Modern OpenGL 03 - Matrices, Depth Buffering, Animation

— Category: Modern OpenGL Series

In this article, we will replace our immobile 2D triangle with a spinning 3D cube. The end result will look like this:

Now that we're finally getting something interesting on the screen, I can include more pictures! An album of animated gifs is available here:

In order to make this spinning cube, we will learn a bit about matrix math, and how it is used to create perspective projections, rotation, translation, and the concept of a "camera." We will also learn about depth buffering, and why it is necessary. We will also see how a typical 3D application implements changes over time, such as animation.

Modern OpenGL 02 - Textures

— Category: Modern OpenGL Series

In this article, we will be adding a texture to the triangle. This will involve adding new variables to the vertex and fragment shaders, creating and using texture objects, and learning a bit about texture units and texture coordinates.

This article introduces two new classes to the tdogl namespace: tdogl::Bitmap and tdogl::Texture. These will allow us to load an image from a jpg, png, or bmp file into video memory, for use in the shaders. Also, the tdogl::Program class has some new methods for setting shader variables.