PDA

View Full Version : Shading problem



openqc
03-16-2004, 07:10 AM
When I draw triangles using the following codes, the edges which are the intersection of two triangles are not shaded smoothly. The edges are shaded like saw. Please let me know
how to make shading triangles smoothly.

glBegin(GL_TRIANGLES);
glHint(GL_PERSPECTIVE_CORRECTION_HINT , GL_NICEST);

glNormal3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 60.0f);
glVertex3f(-15.0f, 0.0f, 30.0f);
glVertex3f(15.0f,0.0f,30.0f);
glEnd();

Thanks
Hyungu Park

Relic
03-16-2004, 08:18 AM
Sawtooth shaped intersections normally occur if your depth buffer precision is too low.
- In the pixelformat request a depth buffer with 24 bits.
- Use a projection setup which encloses the object you draw with the zNear and zFar planes as close as possible, that is, make the ratio of zFar/zNear as small as possible by pushing zNear out and zFar in.

openqc
03-16-2004, 08:49 PM
Thanks you so much...I think I solved the problem with your help.