Weird Drawing Behavior

I am working on a 3D rendering program that is showing some odd behavior in one scenario. An object is drawing completely distorted like some verticies have incorrect values. If I change the shade model from flat to smooth the problem goes away. Also if I disable hardware acceleration it goes away.

It is drawn with a display list of many triangles. I dumped all opengl calls and here is the beginning of the display list:


Does anyone have any idea of what could be happening or how I could figure out what is going on? Thanks in advance!

By the way, I am running Windows XP and I have an NVIDIA Quadro Fx 570 graphics card.

Why do you use short type to represent normal vectors?

When you set smooth shade model, fragment color is the result of the face vertices color interpolation, otherwise fragment color is set by one of the vertices color. So when you set normals you should set smooth shading using the fixed pipeline.

I use short normals to save memory since I can have millions of triangles in some cases.

“So when you set normals you should set smooth shading using the fixed pipeline” - could you explain this a little more, I don’t follow?


Aah, I did not see you set normals per triangle :). So with flat or smooth shading it would not change anything. Is it possible to have a screenshot of the problem?
Are you sure your normals are correctly normalized? You can ask opengl to do it for you with glEnable(GL_NORMALIZE) is your display list to see if it changes something.

I am having trouble pasting an image (screenshot) into the post, is there a way I am suppose to do it or a way to attach an image?

I will try adding glEnable(GL_NORMALIZE) to see if it changes anything. I left it out since the normals are (suppose to be) already normalized.

GL_NORMALIZE did not change it…

I found why it was working with smooth shading. It is because smooth shading takes a different code path in my program that does not use a display list. So if I draw it using a display list it is becoming distorted but if I draw without one it draws fine. Any ideas???

display list or not should not change anything.
probably your different code paths also have different bugs.

you can upload the screenshots on a hosting site like this one, then copy and paste the url they give to you in your post, it should work then.

Zbuffer is right, it should be something in your code. Is it possible to have the relevant code instead of dumped opengl calls?