Animation

Tom Kelliher, CS 320

Feb. 16, 1998

Announcements:

From last time:

  1. Viewports, rendering adjacent objects properly.

Outline:

  1. Double buffering.

  2. Modelview transformations.

  3. Pong design.

Assignment: Read 6.1--6.4 (pay particular attention to orthographic projection), 12.6 (animation), and work on pong.

Animation

Two example programs: double.c and pong.c .

Double Buffering

  1. Why did the time look so bad in paint.c?

  2. Consider video refresh and OpenGL refresh:

    Synchronization?

  3. Consider double buffering:

  4. Is double buffering a cure-all? No, some jitter is possible if render rate is a near multiple of refresh rate.

double.c

  1. A rotating square.

  2. Demo with and without double buffering.

  3. Key points:
    1. Use of GLUT_DOUBLE in call to glutInitDisplayMode.

    2. The idle function, spinDisplay updates spin factor and posts a display callback.

    3. display re-renders.

  4. Use of glRotate* to multiply current matrix.
    1. First parameter is degrees of rotation.

    2. Next three parameters specify axis of rotation as a vector.

  5. Use glPushMatrix/ glPopMatrix to save/restore original values.

pong.c

My first video game. Wow.

  1. What are the elements in the game?

  2. What animations are there? What functions do they map to?

  3. What are the boundary conditions?
    1. Velocity.

    2. Bounces.

    3. Acceleration.

    4. Randomization.

    5. Misses.

    6. Points, time?

Details:

  1. Creating/rendering the ball.

  2. Moving the ball: glTranslate.

  3. Accessing cursor control keys: glutSpecialFunc.



Thomas P. Kelliher
Sun Feb 15 17:45:41 EST 1998
Tom Kelliher