Animation in OpenGL
An Introduction
Prof. David Bernstein
James Madison University
Computer Science Department
bernstdh@jmu.edu
Definitions
Animate:
To give life or motion
Animation:
A group of techniques that can make visual content appear to move
A Simple Animation Loop
Transform the content
Render the content "off screen"
Clear the screen
Move the off-screen "image" to the screen
The Content
openglexamples/basics/animation.c (Fragment: content)
Initialization
openglexamples/basics/animation.c (Fragment: init)
Updating the Content
openglexamples/basics/animation.c (Fragment: update)
Rendering/Displaying the Content
openglexamples/basics/animation.c (Fragment: display)
A Common (Bad) Way to Animate
Animate as Fast as You Can
openglexamples/basics/badanimation.c (Fragment: setupIdle)
openglexamples/basics/badanimation.c (Fragment: idle)
The Correct Way to Animate
Use a Timer
openglexamples/basics/animation.c (Fragment: setupTimer)
openglexamples/basics/animation.c (Fragment: timer)
There's Always More to Learn