Hi all,
I draw a circle and try to rotate it on the Y axis, but it does not work as i think. It works well on every
first PI/2 rotate, but when the second PI rotate begins, the circle becomes very big, with rotate continues,
it occupies all the client area, then it begins to become small and return back to its origin mode. How to
solve this problem? Thanks a lot!
my code is as follow:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
float r;
static float angle;
glTranslatef(0.0f, 0.0f, -2.0f);
glRotatef(angle, 0.0f, 1.0f, 0.0f);
float fxMin, fxMax, fyMin, fyMax;
GL_GetViewRange(-2.0f, fxMin, fxMax, fyMin, fyMax);
r = min((fxMax-fxMin)/2, (fyMax-fyMin)/2) - 0.5;
glBegin(GL_POLYGON);
for (float f=0.0f; f<2*PI; f+=0.01f)
{
glVertex3f(r*cos(f), r*sin(f), 0.0f);
}
glEnd();
angle -= 0.05f;
Thanks again!