PDA

View Full Version : Texture mapping a sphere?



UnderWear
12-18-2002, 05:04 PM
I made a sphere using this code below:
"
GLUquadricObj *qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_FILL);

glColor3f(0,0,1);
gluSphere(qobj, 1,40,40); "


Does anyone know the simplest way to map a bmp file to the sphere? I'm completely lost here.


I've been doing searches and it seems that gluQuadricTexture will work the best, but I don't know what to do with it, nor what else I need.

Help?

nexusone
12-18-2002, 05:23 PM
I have an example of texture mapping a glusphere on my website called glBall, I use a TGA file as my texture. But the idea is the same, just the routine for loading the image file is diffrent.

http://www.angelfire.com/linux/nexusone/


Originally posted by UnderWear:
I made a sphere using this code below:
"
GLUquadricObj *qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_FILL);

glColor3f(0,0,1);
gluSphere(qobj, 1,40,40); "


Does anyone know the simplest way to map a bmp file to the sphere? I'm completely lost here.


I've been doing searches and it seems that gluQuadricTexture will work the best, but I don't know what to do with it, nor what else I need.

Help?



[This message has been edited by nexusone (edited 12-18-2002).]

UnderWear
12-18-2002, 05:35 PM
I think I'm in over my head.
I went to site and found the sphere that you did, I just understand how you import a file to be mapped to the sphere?

Is this correct below?
I'm just really lost as to what else I need.
Here's the part where I draw:

glColor3f(0,0,1);
GLUquadricObj *qobj = gluNewQuadric();
glNewList(list[0], GL_COMPILE);
gluQuadricOrientation( qobj, GLU_OUTSIDE);
gluQuadricDrawStyle(qobj, GLU_FILL);
gluQuadricNormals(qobj, GLU_SMOOTH);
gluQuadricTexture( qobj, GL_TRUE ); //enable TexCoord generation
gluSphere(qobj, 1,40,40);
glEndList();
gluDeleteQuadric( qobj );

[This message has been edited by UnderWear (edited 12-18-2002).]

KenR7A
12-18-2002, 07:38 PM
I think http://www.gametutorials.com/ has a tutorial on quadrics that are also texture mapped. check that out.

[This message has been edited by KenR7A (edited 12-18-2002).]

UnderWear
12-18-2002, 07:43 PM
hehe. Yeah, I looked at that but for some reason kept give me unresolved external errors.

Thanks for the help though. I'll keep trying.

I hate computers.