CPEN 461/661, Spring 1997
OpenGL Tutorial

  1. The Event Loop
  2. OpenGL programs often run in an event loop. This means that, upon program instantiation, some initialization code may be executed and then the program falls into an infinite loop accepting and handling events. Events include operations such as key press, mouse movement, mouse button press, mouse button release, reshape window, expose window, and display. A reshape event occurs anytime the program window is resized. An expose event occurs when the program window is initially displayed and also any time that it is brought to the foreground. A display event occurs after one or more of the other events are handled.

    Events.c Source Code

    This example extends Hello_World.c to accept and handle events. The binary Events should be run and the user should try to produce each of the following events: key press, mouse movement, mouse button press, mouse button release, reshape window, and expose window.