PDA

View Full Version : gluSphere texture poles



Manojo
12-07-2007, 04:48 AM
Hello,

I have created a gluSphere which has normals pointing inside, because I would like to position myself inside the world.

I have then tried to texture it with a jpg. The problem is that the poles of the sphere, when textured, are in z coordinates, whereas they should be on y coordinates.

Is it possible to define this, or do we just have to rotate the sphere ?

Here's the sphere definition code :


theWorldObj = gluNewQuadric();
gluQuadricDrawStyle(theWorldObj, GLU_FILL);
gluQuadricNormals(theWorldObj, GLU_SMOOTH);
gluQuadricOrientation(theWorldObj, GLU_INSIDE);
gluQuadricTexture(theWorldObj, true);


Here's the code in the main which binds the texture :


//render some geometry
//activate texturing
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,worldImage);

//translations and rotations inside the world
glTranslatef(a_d_Key, 0.0f, w_s_Key);
glRotatef(left_right_Key,0.0,1.0,0.0);
glRotatef(up_down_Key,1.0,0.0,0.0);

gluSphere(theWorldObj, worldRadius, 30, 30);
glDisable(GL_TEXTURE_2D);


Thanks,
Manojo

Trenki
12-07-2007, 06:43 AM
I'm not 100% sure but I guess you would simply have to rotate/transform the sphere so that it is to your liking.

[ www.trenki.net (http://www.trenki.net) | vector_math (3d math library) (http://www.trenki.net/content/view/16/36/) | software renderer (http://www.trenki.net/content/view/18/38/) ]