I have a problem with my OpenGL program on my Radeon HD6950. I tried to render a square with a simple vertex shader (only one attribute: position). I am explicitly binding my vertex attributes to specific indices via glBindAttribLocation prior to glLinkProgram. In this case I bound ‘in vec3 VertexPosition’ to index 1 and enabled it in my vertexarray object.
But when I use an index of 0, the geometry gets drawn! This made me wanting to know if it was my fault for thinking that I could use any index from 0 to MAX_ATTRIBS or if it was a driver bug, so I sent the test program to a friend of mine, who uses an NVidia graphics card. He told me that both versions, with index 0 and 1, worked for him. That made me curious and through Google I found a closed thread in this forum that explained that it is a driver bug (I can’t link it here?).
My question now is: Is this bug still not fixed, or is it a problem on my side? I am using an OpenGL 3.0 context at the moment (because of compatibility and SDL and stuff), maybe it will fix if I move on to a 3.2 core context?
If you use a compatibility context (which you probably do) then vertex attribute index 0 is mandatory. Switching to a core context should fix your issue.
I am using an OpenGL 3.0 context at the moment (because of compatibility and SDL and stuff)
I rather doubt that. Odds are good that your driver is giving you whatever version it wants, just using the compatibility profile. So you’re probably getting 3.3 or 4.2, assuming recent drivers.
In any case, yes, this is a long-standing AMD driver bug; the core profile should allow you to not need attribute 0. Both NVIDIA and AMD violate the spec on this. NVIDIA allows you to not use attribute 0 even on compatibility (where that’s not legal, but see below), and AMD requires you to use it even in core.
The workaround is to always use attribute 0. I wouldn’t expect AMD to fix this anytime soon.
If you use a compatibility context (which you probably do) then vertex attribute index 0 is mandatory. Switching to a core context should fix your issue.
Actually, that’s no longer true for 4.3 compatibility. Because of the way they redefined how rendering works in compatibility, core and compatibility are defined to operate in the same way.