Archived

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

lobravo

Quadric Sphere problems

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
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
Guest Anonymous Poster
Try moving the glBindTexture function to the line above glRotatef(...)

I noticed that a lot depends on the order of function calls. Let me know if this works.

Share this post


Link to post
Share on other sites
Yes, it did work. It was the problem. Now, everything OK. HEHE, I''m doing a DEMO of a Meteor that is going against the Earth. I have about 15 Scenes already working. It''s my first long demo. I put as background music "Aneurysm" by Nirvana. I needed to get out a littl of quality of the mp3

When I finash it, i put a link to it :D

Just one or two days yet...

Share this post


Link to post
Share on other sites