PDA

View Full Version : stange face overcoss



Fredy
02-21-2001, 01:49 PM
(stange hm,hm.. mistake i mean strange)
My init code is:
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.0f,0.0f,0.0f,1.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
And when i try to display a cube there are strange triangles on the edges of the cube.
The triangles have textures of the back face.
When the cube is moving the triangles are changing there shape according to the movement of the cube.
When i call the
glPolygonMode(GL_BACK,GL_LINE);
function then the effect is gone.
Is this a solution?? or?
(Picture of the effect: http://www.kmit.sk/~grex/) (http://www.kmit.sk/~grex/)


[This message has been edited by Fredy (edited 02-21-2001).]

[This message has been edited by Fredy (edited 02-21-2001).]

mango
02-21-2001, 07:22 PM
Calling glPolygonMode(GL_BACK,GL_LINE) does not sound like a good solution. Something is wrong with your code. Try to enable backface culling and check the result.

GPSnoopy
02-22-2001, 01:45 AM
Looks like a Z-BUffer stuff to me, it's not accurate enough.

Try with a 24/32bits Zbuffer or try glDepthFunc(GL_LEQUAL);

But anyway, you should enable backface culling too as Mango said. It will avoid backfaces to be rendered, and thus it will avoid the problem you're having in that case.

GPSnoopy
02-22-2001, 01:49 AM
Maybe the projection frustrum far limit is "too far".
If this value is too big, it reduces the Z-buffer accuracy.

Fredy
02-22-2001, 08:35 AM
Tnx guys! Problem solved.