Hi,
i am using at the moment cg for my shaders. First i render lightmap-pass and adding texture/shader-pass. Because of adding it i need to use glDepthFunc( GL_LEQUAL ). If i turn of shaders everthing is fine and sorts well.
If i turn on shaders a get bad z-fighting because of vertex shader. I think using this matrix:
cgGLSetStateMatrixParameter(modelViewMatrix, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY);
in the vertex shader(code in shader : OUT.HPos = mul(modelViewMatrix, IN.position)) brings not the same result as “pure” OpenGL. Any idea on how to fix it? my last hope is using GLSL will fix this issue but if there is another solution with less work it would be great.
btw, glPolygonOffset is no solution because of adding the shader-pass it will bring some ugly pixels on the edges of the polygons