Jump to content
  • Advertisement

rsjagtia

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

122 Neutral

About rsjagtia

  • Rank
    Newbie
  1. rsjagtia

    Texture mapping an Earth Rotating

    Hah, thats a great point! Can't believe i didnt think of that:).
  2. rsjagtia

    Texture mapping an Earth Rotating

    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?
  3. 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);
  4. Hey Folks, So i'm a newbie at OpenGL and graphics in general but all i'm trying to do is Render a cube with a texture mapped on to each face (Same texture). My problem is: Front/bakc face: Correct Left/Right Face: Texture is mirrored on the Y axis (i.e..its flipped so its backwards..horizontally) Top/Bottom Face: No Texture appearing Now here is the code i'm using: GLfloat textureCoords[8][2] = {{0.0, 1.0} , {1.0, 1.0}, {1.0, 0.0}, {0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0, 0.0}, {1.0, 0.0} }; GLubyte cubeIndex[24]= {0, 1, 2, 3, 0, 4, 5, 1, 0, 4, 7, 3, 1, 5, 6, 2, 4, 5, 6, 7, 7, 6, 2, 3}; Vertex cubeVertex[8] = {Vertex(-1.0, 1.0, 1.0), Vertex(1.0, 1.0, 1.0), Vertex(1.0, -1.0, 1.0), Vertex(-1.0, -1.0, 1.0), Vertex(-1.0, 1.0, -1.0), Vertex(1.0, 1.0, -1.0), Vertex(1.0, -1.0, -1.0), Vertex(-1.0, -1.0, -1.0)}; Vertex is a struct that encapsulates the GLFloat [3] ..x,y,z The cube is rendered with the texture, its just the texture is not oriented right and no matter what indices I use for the left and right face, its always mirrored. Further more the top and bottom face show no texture at all. Now when i move the camera inside the cube, the Texture is FINE on the left and right face. A preview is found here: http://img230.imageshack.us/my.php?image=rendercw2.jpg Any help is appreciated. Thanks guys.
  • 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!