Schabby's Blog
OpenGL, Java, Cassandra and other stuff that totally makes the world go round

In this tutorial, we will discuss how to load a shader in OpenGL.


In order to get up and running with OpenGL and LWJGL, one need to understand the most basic setup of LWJGL. This is important to understand because all following examples will be based on that.


As a geeky StarCraft II fan boy, I thought I'd give it a try to thrum my own little StarCraft song. This idea is not exactly new, there are quite a number of StarCraft songs around. Some of these songs are pure awesomeness, some of them make me wonder if they are disturbingly meant serious or not. In any case, StarCraft songs are en vogue and a nice prove of creativity amongst nerdy gamers.


In the previous article we learned about spaces and how to position and orient objects in world space by applying transformation matrices on them. We also learned about camera space, that is simply another coordinate system within the world space.


In the previous article, we discussed the camera transformation which maps a vertex from world space into the camera space. Recall that the camera spans a orthonormal coordinate system with the three vectors \vec{u}, \vec{v} and \vec{w}, where -\vec{w} points along the viewing direction.

In this section we will deal with the projection of the 3D vertex in camera space into a 2D view plane. In OpenGL, what follows is clipping and mapping to so-called normalized device coordinates which are tightly coupled into the construction of projection matrix. In fact, the pure mathematical construction of the projection matrix is easy. What makes it difficult is the clipping part.