Apply Texture to 3D sphere


I know this is more like an openGL problem, but maybe someone here can help me.

I am trying to apply a texture (of the world map) in a sphere.

Here is the code:

	glTranslatef(centerX, centerY, centerZ);  
    // enable texturing  
    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, (GLuint)worldTexture.tex.textureName[0]);  
	//glutWireSphere(200, 30, 30);  
	gluSphere(sphere, 200, 30, 30);  

(I had to turn ofImage.tex and .textureName public)

To load the texture i put the following code on Setup():

ofImage worldTexture;  

I tried applying the texture to a gluSphere and a glutSolidSphere but without any luck.

Does anyone has any experience in applying texture to 3D objects?

Is the texture there if you just draw it on a quad ?

Also, what happens if you do:

glBindTexture(GL_TEXTURE_2D, (GLuint)worldTexture.tex.textureName[0]);

(I never used texture rectangles and am not too familiar with this bit of OpenFrameworks)


Found the problem:

Image must have size of 2 power n, and be square:

8x8, 16x16,…1024x1024…

Also one should call

gluQuadricTexture( sphere, true );

After constructing the quadric…

hi are you shure that this works like

glBindTexture(GL_TEXTURE_RECTANGLE_ARB, (GLuint)worldTexture.tex.textureName[0]);

image.tex.texturename[0] do not exist

you put any other thing?