Since upgrading to the 4.1 drivers, I’ve found that certain shaders cause VBO to crash. For example, the following vertex shader crashes with VBO (modified version of 3DLabs’ wood shader)
attribute vec4 weight;
varying float lightIntensity;
varying vec3 Position;
uniform vec3 LightPosition;
uniform float Scale;void main(void) {
vec4 pos = gl_ModelViewMatrix * gl_Vertex;
Position = vec3(gl_Vertex) * Scale;
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
lightIntensity = abs(dot(normalize(LightPosition - vec3(pos)), tnorm) * 1.5);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = weight;
}
If I comment out the last line so that it ignores the weight attribute, or if I use standard vertex arrays, the code runs fine. I’ve double checked my vertex array class and I can’t find any problem.
Note that it doesn’t matter whether or not I specify a vertex attribute array. The only way to stop it crashing is to disable VBO or remove that line from the shader.
The crash itself is really odd, in that I can’t trace the location in the VC++ debugger. It just gives me an access violation reading location 0x0000000 and then dumps me somewhere in the vertex array code which is not where it was before the crash.
I’m thinking it’s an issue with using VBO, GLSL and vertex attributes together. Has anyone else stumbled across this problem?