PDA

View Full Version : Glu quadrics: sphere will not rotate further than 180 degrees

Structural
12-27-2002, 02:15 AM
I have a spinning, textured sphere in my program but for some odd reason it won't rotate further than 180 degrees (90 to either side).

As soon as the back side is ABOUT to show, it bounces back.

void Ball3D::draw()
{
glPushMatrix();
glTranslatef(pos.x,pos.y,pos.z);
glRotatef(rot.x,1,0,0);
glRotatef(rot.y,0,1,0);
glRotatef(rot.z,0,0,1);

glColor3f(1,1,1);
gluSphere(ball,diameter/2,32,32);

glPopMatrix();
}

The rotation (the "rot" vector) definately goes over 90 degrees in either direction.

TY

nexusone
12-27-2002, 05:09 AM
Are you rotating it a full 360?

How about the code that does the math for the rotation.
look something like this:

rot++;
if (rot > 360) rot = 0;

I have an example of a textured ball using glusphere on my web site.

It is called GLball under projects.
http://www.angelfire.com/linux/nexusone/

Originally posted by Structural:
I have a spinning, textured sphere in my program but for some odd reason it won't rotate further than 180 degrees (90 to either side).

As soon as the back side is ABOUT to show, it bounces back.

void Ball3D::draw()
{
glPushMatrix();
glTranslatef(pos.x,pos.y,pos.z);
glRotatef(rot.x,1,0,0);
glRotatef(rot.y,0,1,0);
glRotatef(rot.z,0,0,1);

glColor3f(1,1,1);
gluSphere(ball,diameter/2,32,32);

glPopMatrix();
}

The rotation (the "rot" vector) definately goes over 90 degrees in either direction.

TY

Structural
01-01-2003, 11:40 PM
I found the problem... stupidity on my behalf.
I disabled depth testing for drawing a roster and forgot to re-enable it. What was happening was that it was drawing the back side of the ball too and appeared when it crossed the 90degree border.