I recently replaced my broken Nvidia 9800GS card with an ATI Radeon 5850 - i love it. So I decided it was time to do some opengl programming again and I ran in to the most peculiar bug. The following code dynamically creates a mat4 array for rotating around the Z axis:
mat4(cos(angle), -sin(angle), 0.0, 0.0, sin(angle), cos(angle), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
I italicized the first and throw columns so that you can visually parse it. It's column-order always in GLSL code. The problem was - when using the transformation, I was getting the z-coordinates of my vertices completely squashed and thus the rendering was completely broken.
I started to investigate and to my surprise found that my rotation matrix rotateZ[2][2] == 0.0; this makes no sense, it's clearly initialized as 1.0! .. the first four entries were correct though, so I changed my initialization code to the following:
mat4(vec4(cos(angle), -sin(angle), 0.0, 0.0), vec4(sin(angle), cos(angle), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
This actually worked, everything ran as it should. This clearly demonstrates there is a bug in the opengl drivers glsl compiler of some sort, where it's ignoring the 16 float variant of the mat4() constructor. I'm running the latest drivers and my opengl version comes back as 4.0.9836. I have no idea how you're meant to proceed when you encounter this sort of bug except to rewrite the code.. but that doesn't make me feel very comfortable.