View Full Version : Rotating a circle of points
04-22-2001, 03:29 AM
I've managed to draw out a circle of points out onto a window screen. Now I'm trying to rotate it with the use of the glRotatef() and the glutTimerFunc(). I compiled and executed the program, but the window screen is totally transparent. Can anybody help me with the syntax on my code? Perhaps I'm either missing a gl function or my math logic is totally wrong.
04-22-2001, 03:37 AM
Here's the the code for drawing the window contents and the callback function for glutTimerFunc().
GLfloat x, y, angle;
GLfloat PI = 3.1415;
glRotatef(Xrot, 1.0f, 0.0f, 0.0f);
glRotatef(Yrot, 0.0f, 1.0f, 0.0f);
for(angle = 0.0f; angle <= 2.0 * PI; angle += 0.0f)
x = 50.0f * sin(angle);
y = 50.0f * cos(angle);
glVertex3f(x, y, 0.0f);
void TimerFunction(int value)
Xrot += 0.1f;
Yrot += 0.1f;
glutTimerFunc(33, TimerFunction, 1);
I haven't tried your code but I can see that you're in an infinite loop. You're not incrementing angle.
04-24-2001, 12:47 PM
Yeah, I kinda figured that out a couple days ago, and that was the problem within the source code. I just get a little blurred vision when I'm copying code from pencil to paper to keyboard. Thanx for the help though.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.