Chapter 4: Entering the Third Dimension Released

Posted on 25 Jun 2011 by Eddy Luten.

An issue was brought up yesterday concerning a bug in Chapter 2. If you change the layout input layout qualifiers in your GLSL shaders from that chapter to the following:

layout(location=18) in vec4 in_Position;
layout(location=1) in vec4 in_Color;

And update the calls to glVertexAttribPointer and glEnableVertexAttribArray accordingly, you will see nothing but a black screen on AMD hardware.

It turns out that this is a known bug, and someone on the OpenGL forums encountered this last year, so this bug has existed for a while.

After contacting OpenGL bug-basher extraordinaire Christophe Riccio (who runs a great site at, he informed me that the only way to get this to work on AMD is to assign location 0, meaning that the following works:

layout(location=18) in vec4 in_Position;
layout(location=0) in vec4 in_Color;

So keep in mind when writing your programs to always occupy location 0 for something.

Chapter 4: Entering the Third Dimension Released

Posted on 24 Jun 2011 by Eddy Luten.

I'm happy to inform you that Chapter 4: Entering the Third Dimension is now available online by clicking on this link.

Let me know if you have any issues, bugs, errors, or simply wish to yell at me. Happy reading.

Now at Google Project Hosting

Posted on 16 Jun 2011 by Eddy Luten.

Google Project Hosting Logo After a few requests for the Visual Studio Solution, I've moved the source code over from my self-hosted solution to a Google Project Hosting solution. In the process, I've also Open Sourced the source code (not the chapters or the site, just the code) under the MIT license, a very permissive Open Source license that allows you to use the code for any purpose you want.

The project itself is a Visual Studio 2010 solution containing individual projects for each of the chapters. If you have Subversion, you can check out the entire project, or if you'd like to view the files in your browser, you can do so here much better than I could implement on this site. Note that even though the project is a Visual Studio solution, the source can be compiled on many platforms.

openglbook-samples project @ Google Project Hosting

Chapter 4 Preview

Posted on 16 Jun 2011 by Eddy Luten.

Chapter 4 Preview It's been a little while since the last update, but work on Chapter 4 is finally reaching a conclusion. In this chapter, we'll make our first steps into the third dimension and introduce a bit of required mathematics.

If you haven't read the previous chapters yet, I highly recommend you doing so before continuing with this chapter since you'll need to understand all of the previous concepts.

Keep an eye out for this chapter in the near future!

glGenVertexArrays Access Violation/segfault with GLEW

Posted on 02 May 2011 by Eddy Luten.

Access Violation If you've been copying the code from the chapters, you may run into trouble when your program hits the glGenVertexArrays function in the form of an Access Violation/segfault.

To fix this, add the following statement right above your call to glewInit:

glewExperimental = GL_TRUE;

There seems to be some trouble with GLEW not entirely supporting the Core Profile out of the box, but the above fix should get you by for the time being.

Fork me on GitHub