Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

lobravo

Quadric Sphere problems

This topic is 5494 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

I made a sphere and put a texture in it. But there is a problem. and I rotate the sphere using glRotatef. But when the angle is bigger than 180º, the texture inverts itself. I copied some codes from many places, put the error is always the same. did u understand? Could some one help me? "There r people who live in the reality. We recreate it!"

Share this post


Link to post
Share on other sites
Advertisement
Here''s the code:

In the INIT Function I created a Quadric:
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.0, 0.0, 0.0, 0.5);
glClearDepth(1.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
Quadric:= gluNewQuadric;
gluQuadricNormals(Quadric, GL_SMOOTH);
gluQuadricTexture(Quadric, GL_TRUE);
LoadGLTextures;
BuildFont;

Then in the DrawGLScene I made just it. I used the Nehe Basecode
glLoadIdentity;
glTranslatef( 1.0, 1.0, -12.0);

glRotatef( yrot, 0.0, 1.0, 0.0);
glBindTexture( GL_TEXTURE_2D, textures[2]);
gluSphere( Quadric, 1.3, 32, 32);

I load the texture normally, using the filters GL_LINEAR.

Just it. That''s it. All the code.

Share this post


Link to post
Share on other sites
How are you getting yrot?

I know i had this problem when i used the atan function.

Share this post


Link to post
Share on other sites
just a question... is it possible to modify the position of just the vertices of quadric shapes?

Share this post


Link to post
Share on other sites
the yrot is a GluInt. I verify if the keybord''s arrow keys are being pressed. if, for example, the up arrow key is being pressed, I sum yrot + 0.15, for example.

Share this post


Link to post
Share on other sites

  • 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!