Unexplainable errors in image

Hi folks,

I’m new to OpenGL, and I’m currently trying to display the contents of some geometry arrays that have been created using a Wavefront file (.obj) to OpenGL Perl converting script.

The geometry will display on the screen, but theres some big unexplainable artifacts in the image. It only happens when the object is rotated substantially to the diagonal.

Below is an image of three screen shots, showing how the artifacts depend on the rotation of the object…


My mind is jumping to thoughts of Depth Buffering, Materials and Lighting. But I’m such a newb that I’m not sure where to start. Everything seems to be in working order as far as I can see.

The main code can be found >>here<<, and the header file with the geometry arrays >>here<<.

Any help would be massively appreciated!

Thanks in advance!


From looking at just the screenshot you have, it looks very much like a coplanar primitive problem. That is, it’s possibly drawing multiple primitives in the same place and they are fighting to be in front.

If that is the case, then you could have duplicate primitives that aren’t supposed to be there or if they are supposed to be there then you need to look into polygon offset to correct the problem.

You also forgot to enable GL_NORMAL_ARRAY.