Polygon Bugs

My OGL scene is bugged, I am rendering a box, but the rear and side polygons are overriding the front polygon.

Any ideas what can cause this?

Can I see the source code ?

Are you sending the vertices to OpenGL in counter-clock-wise order? This may be a problem.

Try enableling depth test



Sounds like a depth test problem. If you’re using glut and linux, also make sure to use GLUT_DEPTH when you call glutInit(). I got burned with that awhile back when I had depth test enabled, but the depth test didn’t seem to work right.

I do enable depth testing, but I am not sure about the vertexes being loaded coounter-clockwise.

I copied the vertex code straight from nehe tutorial on texture mapping.

One thing though, I adopted NeHe texture mapping tutorial using QT OpenGL Module. Anyone have experiene using this module, any known problems that might cause these issues.

So far I have only tested it on Windows, it might work without issue on linux. Sigh.

Anyone all input is welcome.



Hmmm… just in case you haven’t, make sure to clear the depth buffer each time you render:


… and don’t forget glDepthFunc(GL_LESS);