Hello
I seem to have a problem with the Z-buffer:
http://img394.imageshack.us/img394/5418/zwrong8cd.jpg
As you can see, The part circled in green - should not be seen - it intersect the front face.
I have no idea why it happens…
This is how i draw the outline:
glColor3f(1.0,0.0,0.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0, 1.0);
WireframeDraw(GL_POLYGON);
glDisable(GL_POLYGON_OFFSET_FILL);
glColor3f(1.0,1.0,1.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
WireframeDraw(GL_POLYGON);
and this is how i initialize the openGL:
int w,h;
GetClientSize(&w, &h);
glClearColor(0,0,0,0);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float ratio = (float)((float)w/(float)h);
gluPerspective(60 ,ratio, 1, 150);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDepthFunc(GL_LEQUAL);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
can anybody tell me what’s wrong?
thanks