Archived

This topic is now archived and is closed to further replies.

Bretttido

glEvalMesh2 w/ glutSolidSphere

Recommended Posts

Bretttido    122
Hi, I''m having a bit of problem in my program when I attempt to create a 2D Bezier surface with glEvalMesh2 AND create a glutSolidSphere. The Bezier surface works just fine alone; however, when I add glutSolidSphere anywhere in the program, the Bezier surface is no longer lit correctly. Anyone know where my problem may be coming from?

Share this post


Link to post
Share on other sites
Bretttido    122
Well, I figured out how to fix the problem... though why this works, I''m really not sure. After making a call to glutSolidSphere (or gluSphere), the glNormal seems to be modified. Changing it back to (0,0,1) seems to allow the Bezier curve to be lit properly.

Share this post


Link to post
Share on other sites
zedzeek    529
check out the source to glut to see whats happening

void APIENTRY
glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
{
QUAD_OBJ_INIT();
gluQuadricDrawStyle(quadObj, GLU_FILL);
gluQuadricNormals(quadObj, GLU_SMOOTH);
/* If we ever changed/used the texture or orientation state
of quadObj, we''d need to change it to the defaults here
with gluQuadricTexture and/or gluQuadricOrientation. */
gluSphere(quadObj, radius, slices, stacks);
}

gluSphere generates its own normals thus the last normal used will be the current normal when u leave the function

use glGetFloat(...) with GL_CURRENT_NORMAL to find the currently active normal

Share this post


Link to post
Share on other sites