C481 B581 Computer Graphics
Dana Vrajitoru

2D Animation in OpenGL

Introduction to 2D Animation In OpenGL Generic Idle Function
void idleAnim()
{
    for (each object)
        object.update();

    display();
    
}

Hard to control the animation speed - platform dependent.

Generic Timer Callback

void anim(int value)
{
    if (value) {
        for (each object)
            object.update();            
        display();
    
        glutTimerFunc(msecs, anim, newValue);
    }
}  
Double Buffers Other Timers 2D Collision Detection