I have found understanding OpenGL 3.x to be a difficult topic to really pick up on online. There are some good tutorials, specifically at OglDev, but overall it’s not nearly as covered a topic as DirectX. This doesn’t surprise me, since Microsoft has spent years aiming DirectX at the game community and Windows is at least 85% of the PC game market (probably closer to 90-95%). So why would a game programmer worry about OpenGL at all?
Well, to be honest, my biggest reason for focusing on OpenGL is that we use it in our game classes at DePaul University. If we used DirectX instead, I’d be working on that instead. However, the perspective from this side of the fence has been interesting. DirectX has quite a few helper classes available to it, such as a font class and math classes that you can just plug and chug away. With OpenGL, I have to do this type of work on my own. It has forced me to really think about the representation of a font in a program, for example, or even a simple GUI. How does a slider bar work exactly? How does it get drawn? I appreciate this lowest-of-levels look at programming.
Most online resources for OpenGL tutorials still focus on the fixed pipeline of OpenGL 2.1 and earlier. This functionality still works just fine, and probably won’t go anywhere in GPUs of the future, but the world of video games is moving on. Many AAA titles being released this year requiring DirectX 10, which is programmable pipeline based, which is the equivalent to OpenGL 3.0 and above. The world is advancing to the point where the best studios use shaders to work with their game data. For someone to wants to work in the industry, I can’t bother with fixed pipelines anymore.
The best resource for learning modern OpenGL is the OpenGL Superbible in my opinion. The 5th edition of the book focuses on the programmable pipeline, but it has been criticized for using a helper library called GLTools for most of the book. This class encapsulates ideas like a camera, a graphics pipeline, and even emulates old-school fixed function concepts like the old glBegin() and glEnd() functions. This might not necessarily be a bad idea, but my problem with it is that the code itself is hard to work with. It builds but with a ton of build warnings because the author did not include any of the debug files with the library. The author supplied a Visual Studio 2010 solution file, but the files are arranged haphazardly inside it. Overall, I consider myself fairly competent in figuring out technical things, and this whole set felt very messy to me. For someone who is less experienced in the technical world, it may be enough to turn them off the book completely. Based on the reviews on Amazon, this is a very real problem.
The book never really breaks the reader completely free from the helper classes, which is unfortunate. It makes fully understanding some of these concepts harder than it seems it should be. In my own work in understanding OpenGL, I have started to slowly pull the code out of the GLTools library for the source code tutorials, so that instead of using those libraries I can actually see the OpenGL code instead. As I do this I’m going to post the source code and projects on the site here.
My impression of the book itself is that it is very good – Mr. Wright clearly knows a lot about OpenGL, and the book goes into details that no online tutorial I have seen covers. I think these topics are essential for anyone who wants to really understand how not only OpenGL but GPU hardware operates. But the code is just so hard to work with that I think posting a ‘translated’ version of it will be beneficial – certainly for me, and perhaps also for people looking to really understand the nuts and bolts of how OpenGL works.