954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Animation With OpenGl

I am working on an assignment for school and i seem to be having some issues. I am using OpenGl with free glut, and attempting to animate a pendulum. I can draw out the pendulum, but cannot determine how to make it swing. I have to make it swing from -45 degrees to 45 degrees, and i have the line and ball drawn. I have tried several ways to animate it and make it smooth, but i don't completely understand the process of it. I can set it up in a state where it would be at the right spot on both sides, but cannot animate it smooth. I can just make it jump from the two points. Not hitting the points in-between. I have also tried using the rotate and translate function, but it never rotates the line correctly, it always rotates at the axis, but thats not working. I could really use some help if anyone has any experience.
Thanks

c.pentasuglia
Light Poster
34 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

If you can draw it at 45 degrees and -45 degrees, can you also draw it at 44 and -44 degrees? And all the angles inbetween?

How about something as simple as this:

Draw it at 45 degrees.
Wait a tenth of a second.
Draw it at 44 degrees.
Wait a tenth of a second.
Draw it at 43 degrees.
etc.
etc.
Until -45 degrees.

This is crying out to be in a loop of some kind, where each iteration changes the angle.

Moschops
Practically a Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
 

Ahh right that makes sense... but i couldn't put this in the rotate function right? When i try to use the rotate and translations, it always tries to rotate my top end of my line, where i want it to rotate moving my second vertex point.

c.pentasuglia
Light Poster
34 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: