Jump to content
  • Advertisement
Sign in to follow this  
rsjagtia

Texture mapping an Earth Rotating

This topic is 3531 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!