View Full Version : the way to map a sphere?

03-18-2001, 01:00 PM
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.


03-18-2001, 01:03 PM
I don't think GLUT's spheres can be mapped.

03-18-2001, 02:50 PM
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.

03-19-2001, 01:59 AM
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.

03-19-2001, 11:54 AM
......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);.... ?


03-19-2001, 01:00 PM
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.

03-19-2001, 01:37 PM
but, what's Bob means that get not much control from glut?...

03-19-2001, 07:27 PM
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.

03-20-2001, 07:08 AM
I think you had to enable, that OpenGL automatically calcs texture coordinates.
Look at the red-book. I think it's discribed
there !


03-20-2001, 08:45 AM
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.

03-20-2001, 04:00 PM
oh.... i see,
thanks you all... http://www.opengl.org/discussion_boards/ubb/smile.gif