I need open gl source code to make a point move along the circumference of the circle.
I'm studying Physics, not CS, but I've had a few brushes with OpenGL.
I'll use a Basic-like pseudocode syntax since I don't know what language you're using, and basic is very easy to read:
'Constants - Radius is radius of the circle
Const PI = 3.14159, Radius = 10
'Current angle, and angular velocity (dTheta / dt)
Dim Shared Theta as Single, Omega as Single
'Frame is called when you want to draw a new frame
Sub Frame(dt as Single)
'dt is number of seconds passed since last frame (typically less than one, since you want several frames per second)
'Initialize the frame (clear buffers, set up projection, etc)
Theta = Theta + (Omega * dt)
'Calculate co-ordinates of point
X = Radius * Cos(Theta)
Y = Radius * Sin(Theta)
'Set the colour of the point
glColor(<r>, <g>, <b>, <a>)
'Draw the point
'Display the frame
May 16, 2009 |
Advanced Graphics Programming Using OpenGL...