OpenGLBook.com

Chapter 4: Entering the Third Dimension Released

25 Jun 2011

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 G-Truc.net), 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.

Fork me on GitHub