From: Brian P. <br...@va...> - 2001-01-15 20:02:29
|
Stephen Tse wrote: > > Hi Brian and all! > > There seems to be a bug in calculating normals of a sphere in > src-glu/quadric.c. I cannot track down the exact problem or find a > fix, but the following screenshots (one from mesa 3.4, one from sgi > opengl of xfree86 4.0) obviously show something. Note the highlights > of the spheres. > > http://www.sfu.ca/~stephent/tmp/mesa-sphere.gif > http://www.sfu.ca/~stephent/tmp/sgi-sphere.gif How do they compare when you enable smooth shading for the sphere? It may be that because of the vertex order for the triangle strips being different, that a different provoking vertex is being used for filling each facet. The GLU spec doesn't say exactly how the triangle (or quad) strips are to be oriented in gluSphere so this might be an allowable variation. > The code is accanti.c from redbook. I can easily reproduce the bug > with another simplified code. Normals of spheres at origin (no > translation or rotation, quadric.c from redbook) *seem* to be okay. > > http://trant.sgi.com/opengl/examples/redbook/redbook.html > > Also, a (very) minor patch is to remove `TXTR_COORD' calls because of > `!qobj->TextureFlag' condition in the branches. > > #define TXTR_COORD(x,y) if (qobj->TextureFlag) glTexCoord2f(x,y); > > Around line 404 in src-glu/quadric.c, > > if (!qobj->TextureFlag) { > /* draw +Z end as a triangle fan */ > glBegin(GL_TRIANGLE_FAN); > glNormal3f(0.0, 0.0, 1.0); > TXTR_COORD(0.5, 1.0); > > Around line 461 in src-glu/quadric.c, > > if (!qobj->TextureFlag) { > /* draw -Z end as a triangle fan */ > glBegin(GL_TRIANGLE_FAN); > glNormal3f(0.0, 0.0, -1.0); > TXTR_COORD(0.5, 0.0); > Thanks. My plan is to replace Mesa's GLU with the SI GLU someday (when I find time). -Brian |