Sprite Animation in OpenGL
Prof. David Bernstein
James Madison University
Computer Science Department
bernstdh@jmu.edu
Review
The animation approach we used so far is "ad hoc"
This means that we have to write the same code in every application that uses animation
Using Sprites
A Sprite:
Visual content that is responsible for its own dynamic behavior
A Stage:
Forwards timer, mouse, and keyboard events to Sprite objects
Using Sprites (cont.)
Sprite: The Header
openglexamples/animation/Sprite.h
Using Sprites (cont.)
Sprite: The Implementation
openglexamples/animation/Sprite.cpp
Using Sprites (cont.)
Stage: The Header
openglexamples/animation/Stage.h
Using Sprites (cont.)
Stage: The Implementation
openglexamples/animation/Stage.cpp
An Example - Spinning Cubes
Cube: The Header
openglexamples/animation/Cube.h
An Example - Spinning Cubes
Cube: The Implementation
openglexamples/animation/Cube.cpp
Spinning Cubes (cont.)
The Driver
openglexamples/animation/Driver.cpp
An Example - The Solar System
Sun: The Header
openglexamples/animation/Sun.h
An Example - The Solar System
Sun: The Implementation
openglexamples/animation/Sun.cpp
The Solar System (cont.)
Earth: The Header
openglexamples/animation/Earth.h
The Solar System (cont.)
Earth: The Implementation
openglexamples/animation/Earth.cpp
The Solar System (cont.)
Moon: The Header
openglexamples/animation/Moon.h
The Solar System (cont.)
Moon: The Implementation
openglexamples/animation/Moon.cpp
The Solar System (cont.)
The Driver
openglexamples/animation/SolarSystem.cpp
There's Always More to Learn