View Full Version : Flickering Objects

04-01-2004, 10:47 AM
I'm trying to display a cube built out of triangles. All the information is stored in an array of structures and then drawn:

glVertexPointer(3, GL_FLOAT, sizeof(Vertex), &vertices[0].position);
glNormalPointer(GL_FLOAT, sizeof(Vertex), &vertices[0].normal);
glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].texCoord);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, indices);

the problem I'm having though is that when depth buffering is enabled everything flickers as the objects rotated etc.

Dont suppose anyone knows what could possibly be going wrong??


04-01-2004, 12:26 PM
well, if its just when the depth buffer is enabled its probably z-fighting. Either bump out your near clipping plane, or pull in the far one. This may help

04-01-2004, 01:26 PM
That sounds a lot like you aren't using double buffering, although if it really only happens when you are using the depth buffer, it could be something else, but I'm not sure what.

04-02-2004, 03:22 AM
Awww thankyou so much. it was my near and far planes, can't believe how stoopid i was. This has been bugging me for weeks!