Animation

Tom Kelliher, CS 320

Feb. 26, 2001

Administrivia

Announcements

Assignment

Read 4.1, Appendices B and C.

Pong project handout.

From Last Time

Finished paint.c lab.

Outline

  1. Animation: double.c, pong.c

Coming Up

Objects and transformations.

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
Sat Feb 24 16:21:56 EST 2001
Tom Kelliher