I want to write a shader program that has one instance of a fragment shader and no vertex shader. My understanding is that this should work and I should be able to use the default version of the vertex pipeline.
However, in tests using GLSL, it seems values like gl_FragCoord are not set properly. I wonder if its a driver problem or my misunderstanding or if there is something I must do to make this work (extra assumptions I have wrong).
Can someone clarify if I misunderstand or if drivers are not implemented correctly? It is not an option to work from Cg.
No I’m checking and checking and somethings wrong or I’m being dumb.
Please assume I have an OpenGL window and rendering loop. I draw a glRecti(-1,-1,1,1) to fill the screen.
Now if I run it like that I get whats expected… a gently graded colour across the screen in red and green (no blue)…correct.
If I comment out the four lines that create and attach the vertex shader, I get just green on the screen - a flat colour, no gradation. Its clearly wrong. It seems gl_FragCoord is not set correctly if I have no vertex shader.
I’m using default projection and identity for modelview. I’m running under windows XP SP2 with an ATi x1950.
Some ATI cards do not have hw support for the gl_FragCoord and the driver emulates it using varying calculated by vertex shader. It is possible that when the driver emulates the fixed function pipeline, it forgets to generate that varying even when the fragment shader needs it.
You could try replacing the glut part with your own window init code. Then you can also remove the stdlib header. If it still works you have eliminated two possibilities…
NiCo - its the weekend so I get to code again Anyway, I must have been an idiot last weekend. Your glew-glut code doesnt work either. Some how I must have recompiled properly last weekend.
So, to be clear. X1950, XP, SP2, recent drivers…
if I comment out your single line which attaches the vertex shader, I get just green on the screen - clearly wrong, but the same result as my code.
So its not the windows setup and its not stdlib and its not the shader setup code… ATi is definitely broken if no vertex shader is provided.