PDA

View Full Version : Texturing glut shapes



03-31-2002, 05:10 AM
I have this program that is supposed to load a bitmap and the use it as a texture for a sphere that is drawn using glutSolidSphere, but the texture just doesn't appear.
I know there's nothing wrong with the code that loads the bitmap, cause if I change glutSolidSphere to glutSolidTeapot it works!
I've tried with other glut shapes too, but the teapot seems to be the only one that works.
Why is that? What can I do to make it work?

nexusone
03-31-2002, 06:02 AM
You are correct if you read the on-line help on the GLUT primitive shapes your will find that they do not support texture maps other then the teapot..... On the main page of this site is a search window, just type in the gl, glu or glut command and the reference will be pulled up.

These primitive shapes where put into GLUT to replace the glaux functions, they only have normals for lighting.

If you need texture mapping then you need to use gluSphere also look up the use of the following gluNewQuadric, gluQuadricTexture.



Originally posted by Hannes:
I have this program that is supposed to load a bitmap and the use it as a texture for a sphere that is drawn using glutSolidSphere, but the texture just doesn't appear.
I know there's nothing wrong with the code that loads the bitmap, cause if I change glutSolidSphere to glutSolidTeapot it works!
I've tried with other glut shapes too, but the teapot seems to be the only one that works.
Why is that? What can I do to make it work?

04-01-2002, 10:19 AM
Thanks alot, I got it to work now.
However, I came to think of a new question. If these glu functions for drawing primitives support texturing, why would I want to use the glut functions?
Btw, where can I find a complete listing of glu primitive drawing functions? I know I can search this site for info on a particular functions, but I would like something more complete.

chowe6685
04-01-2002, 10:50 AM
nehe.gamedev.net, read the tut on quadratics, alternately you coul just read the header

nexusone
04-01-2002, 11:28 AM
Because there are a lot of useful functions in glut. Like menu functions, mouse, keyboard, etc. Also by using GLUT your program is now platform independent, the same code will work on a mac and linux.

If you wanted to write a simple example of how to move an object in opengl, With GLUT you only call one command to draw a object vs. glu or gl where you need multiple commands to do same thing. It is hard enough for some people to learn openGL, you start throwing in advance lighting a texture right off the bat, you could really blow them away....
http://www.opengl.org/discussion_boards/ubb/smile.gif

It maybe easier to look at it like this

gl opengl base routines
glu opengl base routines wrap into complexe functions.
glut opengl base and glu routines wrap into a easy to use functions.

Other then a book on openGL which does come in handy as a command reference.
There is the on-line redbook, link on here and the nehe page.

Here is the link to the on-line documentation, just look at the index for the command. http://www.opengl.org/developers/documentation/


Originally posted by Hannes:
Thanks alot, I got it to work now.
However, I came to think of a new question. If these glu functions for drawing primitives support texturing, why would I want to use the glut functions?
Btw, where can I find a complete listing of glu primitive drawing functions? I know I can search this site for info on a particular functions, but I would like something more complete.

[This message has been edited by nexusone (edited 04-01-2002).]

[This message has been edited by nexusone (edited 04-01-2002).]