GLSL drives me insane!

I’m working on a GFX5200,and using GLSL.Long story short,here is a very simple piece of code:

Vertex shader:

varying vec4 col;

void main()
{vec4 lpos;



Fragment shader:

varying vec4 col;
void main()

This is not my actual shaders,but a simple example demonstrating the problem(or should I say driver bug?)
The objects should all be colored red,right?Wrong!The colors are completely incorrect,and they even change when I rotate or move the camera.Now,if I comment out the line that accesses the lightsource position,all is fine.Bottom line,if lightsource parameters are present in the code,the varying varables mapping is somehow affected,and the results are incorrect.I downloaded the latest NVidia drivers(61.77),but it didn’t help.So,what’s the deal here?

Sounds like a bug to me. Tried even newer drivers?
I just saw that there’s a 65.90 listed on NVIDIA’s download site if you select Quadro as graphics board.
Googling found even newer ones on Guru3D

I just installed 66.00 from Guru3D,and I still get the same problem.I have completely stopped writing my engine code for about a week,because of this stupid bug.

I have do some tests and asm out of your vertex shader looks same with or without lpos=gl_LightSource[0].position.

Anyway, this line doesn’t do anything useful and it is very strange behavior.

If you want to check asm outpud add following key in registry:

Windows Registry Editor Version 5.00




I can confirm this bug under Linux drivers as well (GeForce FX5600 with 61.11).

I think the compiler for GLSL is still in a beta state, sometimes it talks about warnings which are never shown and I remember having similar problems while coding (code that will never get used influencing the output).

@yooyo: Getting the assembler output from cgc would be nice, do you happen to know how to enable this for the Linux driver?

Try it w/o fragment shader. Shouldn’t there be a 1 for alpha in color? ie. col(1,0,0,1), probably dump suggestion but who knows?

maybe i am wrong, but i think that “col” variable declared in vertex prog is not linked to “col” declared in fragment program. so, in the frag prog variable “col” is undefined. maybe you should try using “gl_Color” instead, both is vert and frag progs?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.