Thanks mhagain, you answered my question.
I have another problem with texturing sphere. I will introduce what I need to get. I have an application where you can move and rotate camera. I want to add textured sphere, which will present the sky. I have written some code and I have the texture placed into my sky, but the texture is rotating with the camera. I always see the same part of the sky.
Before drawing sky I use gluLookAt function.
x, y, z are camera position coordinates, angle is an angle of camera rotation around 0,1,0 vector and angleV rotates camera around 1,0,0 vector.
I want my texture to be placed in constant position, so when I am rotating camera I can see other part of texture.
Here is code of sky rendering function:
void sky() {
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glBindTexture(GL_TEXTURE_2D, skyTexture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
GLUquadricObj* quadric = gluNewQuadric();
gluQuadricDrawStyle(quadric,GLU_FILL);
gluQuadricNormals(quadric,GLU_SMOOTH);
gluQuadricOrientation(quadric, GLU_OUTSIDE);
gluQuadricTexture(quadric, GLU_TRUE);
glTranslatef(x, y, z);
glMatrixMode(GL_TEXTURE);
glPushMatrix();
//glRotatef(angle, 0.0, 1.0, 0.0);
glMatrixMode(GL_MODELVIEW);
gluSphere(quadric, 1000.0, 10, 10);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glMatrixMode(GL_TEXTURE);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}