Sign in to follow this  

Texture mapping an Earth Rotating

This topic is 3317 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey folks, Been using Quadratic objects to generate spheres (gluSphere) and simply binding the texture seems to apply the texture on my planets just fine. However, when i move the camera, the textures start rotating on the planet as well. Initially my earth just spins on its Y Axis and looks fine. If i change the camera orientation in any way, the texture starts rotating on the earth that is not specified by the rotation vector i'm using. My goal is to create an earth with the texture mapped so that when i move the camera around , I can see each "country" correctly. Is there any way i can map the texture on the sphere so that it is independent of view point position ( Locked on the sphere). Initially i used Sphere Mapping but that had the other problem the texture would ALWAYS face the camera. When i disabled that now the texture rotates arbitrarily. Here is the code i'm using: glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, Texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); gluBuild2DMipmaps(GL_TEXTURE_2D, // texture to specify 3, // internal texture storage format width, // texture width height, // texture height GL_RGB, // pixel format GL_UNSIGNED_BYTE, // color component format data); // pointer to texture image .... gluQuadricDrawstyle( m_quadGeo, GLU_FILL ); gluQuadricNormals( m_quadGeo, GLU_SMOOTH ); /* smooth shaded */ glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); gluSphere(m_quadGeo, m_size, 30, 30); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T);

Share this post


Link to post
Share on other sites
Well it appears calling :

gluQuadricTexture(m_quadGeo, GL_TRUE);

Partially fixes my problem. The texture is locked onto the sphere, but the orientation is wrong. Does anyone know how to specify texture co-ordinates onto a sphere that is made via gluSphere?

Share this post


Link to post
Share on other sites

This topic is 3317 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this