• Advertisement

Archived

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

Quadric Sphere problems

This topic is 5284 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
I''m using nVidia TNT2. I guess there''s not prob with my card. I guess...

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
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
i think the rotation needs to be a float value.. integers dont have decimals.

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

  • Advertisement