View Full Version : "warning C7506: OpenGL does not define the global variable gl_FragDepth"

05-04-2006, 03:48 PM
I want to use the depth to set fragment color....

I have tried

gl_FragColor = vec4(gl_FragDepth, 0.0, 0.0, 1.0);but when I run my app, I get the following:

"warning C7506: OpenGL does not define the global variable gl_FragDepth"

I thought gl_FragDepth was a valid variable....

05-04-2006, 04:00 PM
And your hardware and driver is... ?

05-04-2006, 04:32 PM
gl_FragDepth is write-only.

05-04-2006, 04:34 PM
i believe gl_FragDepth is what u write the output depth value u want to
if u wanna access the current depth value (interpoltaed from the vs) use gl_FragCoord.z

05-04-2006, 04:40 PM
A little correction:

gl_FragDepth is write-only.
Well, you can read it, but only after you have written something into it.

05-15-2006, 03:25 PM
Somewhat related to this, when I try to read from gl_FragCoord I get some weird flicker of death, nothing gets rendered and it seems as if the rendering context goes out of whack, glIntercept reveals no issues.

The rather startling thing is that another shader (not coded by me) that uses it in a far more complex manner works fine.

ATI radeon 9600 pro, and catalyst drivers that are no more than 2 months old, I'll get some new ones to be sure.

05-15-2006, 05:59 PM
Unfortunately, using catalyst 6.4 drivers don't help. Can anyone confirm any strange behaviour when trying to read from gl_FragCoord (I can't do anything at all with it)?