Intermediate mode madness

Hey,

OK now I’m drawing some polygons using old plain intermediate mode (for testing only), laying down Z first, and I receive this dready Z-bleeding bug, altought I’m passing exactly the same polygons (vertices) to the GL. However, if I use a single shader only, everything seems alright. Only when I’m changing the shaders and draw the polygons this is showing up. I thought it may be related to disabling FP/VP Cg contexts every time a shader is changed (however, they’re never being used, so there’s no way a poly could be transformed using the fixed pipeline the first time and a custom vertex program the second time), so I’m setting the depth test to LEQUAL, and enable polygon offset right BEFORE drawing each individual polygon, but the Z-bleeding remains…
I tried everything, but still have no idea.

Any ideas?
Thx in advance.

  • phil

Are you using exactly the same vertex shader in both passes? Are you using fixed function for one? Invariance is not guaranteed between fixed function and vertex shaders.

Which hardware? Driver version?

Fixed pipe for both, that’s why I’m so puzzled…

GF6600GT, just upgraded to Forceware 89.98, used to have 89.95, same thing…

I think you mean immediate mode.

Even if transform uses fixed function, just a state change can cause Z invariance.

Right I meant immediate mode.

certain things will cause problems with multiplepasses eg user clipplanes, perhaps polygonoffset.
disable everything until it works and then reenable the states one at a time until u find out the culprit

Originally posted by simongreen:
Are you using fixed function for one? Invariance is not guaranteed between fixed function and vertex shaders.
What about using the invariance flag or whatever it’s called.
In ARB_vp it was
OPTION ARB_position_invariant
and in GLSL
gl_Position = ftransform();