the way to map a sphere?

is there any simple way to map a sphere with glut?
i use

gluBuild2DMipmaps(GL_TEXTURE_2D, 3, Tex1Info->bmiHeader.biWidth,Tex1Info->bmiHeader.biHeight,GL_BGR_EXT,GL_UNSIGNED_BYTE, Tex4Bits);

glEnable( GL_TEXTURE_2D);
glTranslatef(0.0f, 11.2f, 0.0f);
glutSolidSphere(2.f, 25,25);

is it be possibe way work?
but the sphere is dark… not been mapped.


I don’t think GLUT’s spheres can be mapped.

I think GLU spheres can though, and it’s pretty much the same interface. I always thought the GLUT wrapper was a bit pointless here.

You can use GLU to draw the sphere instead. Actually, GLUT uses GLU, but you don’t have that much control from GLUT.

Try gluQuadricTexture to enable texture mapping when drawing the quadric.

…but you don’t have that much control from GLUT.

are you mean that if i draw a glu shpere and mapped it,… but this sphere can not be controled by the functions of glut such as: glutKeyboardFunc(key);
glutMotionFunc(motion);… ?


I think that you are under a misconception. glutKeyboardFunc, glutMouseFunc, glutMotionFunc do not control objects like glutSolidSphere… they act as callback functions to let you know when those events occur. Even using glutSolidSphere, you will have to move the sphere yourself by using functions such as glTranslate/glRotate… the same goes for using the glu Quadrics.

but, what’s Bob means that get not much control from glut?..

I presume that he means you can’t call various glu functions on that sphere created with glut to do things with it (like generating texture coordinates, for example). If you create the sphere from glu, you can use gluQuadricTexture, which you can’t if you use the glut function to draw the sphere.

I think you had to enable, that OpenGL automatically calcs texture coordinates.
Look at the red-book. I think it’s discribed
there !


What I meant what that there is no way of controlling how the object is drawn using GLUT. If you use GLU instead of GLUT for drawing objects, you have much more control.

And for OpenGL’s automatic texture coordinate generation, that is an option aswell. But GLU can generate more acurate texture coordinates that fits the object you are drawing better.

oh… i see,
thanks you all…