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:

glNewList(30,GL_COMPILE)
glBegin(GL_TRIANGLES)
glNormal3s(14176,-27392,11008)
glVertex3fv([745.645996,-110.776863,533.855957])
glVertex3fv([746.505310,-110.517570,533.392639])
glVertex3fv([746.044861,-110.258606,534.631165])
glNormal3s(1344,-21472,-24704)
glVertex3fv([685.436279,-111.156952,463.180542])
glVertex3fv([684.565857,-110.500710,462.562866])
glVertex3fv([685.952454,-110.293732,462.458679])
glNormal3s(4640,-32320,-2432)
glVertex3fv([685.952454,-110.293732,462.458679])
glVertex3fv([684.565857,-110.500710,462.562866])
glVertex3fv([685.285828,-110.314262,461.483887])

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?

thanks.

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?