GLUT EVENTS

DISPLAY EVENT: when window needs to be redisplayed (or window is initially invoked).
-- This is the ONLY event to handle even if you need no other.
-- To register a display callback function called foobar, we call the command
glutDisplayFunc(foobar);

-- The display callback function takes the void argument. [Angel, p.68-69]:
void foobar( void )
{
...
}
MOUSE EVENT: when a mouse button is pressed or released.
-- the measure includes current mouse position, buttons being pressed or released.
-- To register a mouse callback function called meow, we call the command
glutMouseFunc(meow)

-- Such a function takes arguments as illustrated here:
void meow(int button, int state, int x, int y)
{
   if(button == GLUT_LEFT_BUTTON & state == GLUT_DOWN)
      exit();
}
MOTION EVENT and PASSIVE MOTION EVENT: when the mouse is moved, an event is generated.
-- It is considered a passive motion event if the mouse button is not depressed.
-- To register a motion callback function called foo, we call one of the commands,
glutMotionFunc(foo);
glutPassiveMotionFunc(foo);
IDLE EVENT: when no other event occurs.
-- The default idle callback function is the NULL function.
-- We use glutIdleFunc to register our own callback function.
-- The idle callback function takes the void argument.
RESHAPE EVENT: when window is reshaped.
-- We use glutReShapeFunc to register the reshape callback function.
-- The reshape callback function takes the window size (wxh) as its arguments [Angel, p.99]. here is a typical one:
void ReShape(GLsizei width, GLsizei height)
{
glViewPort( 0, 0, width, height);
glMatrixMode ( GL_PROJECTION );
glLoadIdentity();
glFrustum ( -1, 1, -1, 1, 5, 25 );
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0, 0, -15);
}
SOME OTHER EVENTS:
-- TIMER EVENT: triggered after a specified number of milliseconds
-- KEYBOARD EVENT: when ascii characters are typed with mouse in current window.
-- SPECIAL KEY EVENT: when special keys (Function Keys 1--12, arrow keys, page up/down, home, etc) are typed with mouse in current window.
-- VISIBILITY EVENT: when visibility of a window changes. A window is considered visible iff it is not completely covered.
-- ENTRY EVENT: when a mouse enters or leaves the current window.
-- MENU STATUS EVENT: when a menu pops up or when it disappears.
-- OVERLAY DISPLAY EVENT: similar to the DISPLAY EVENT except we also redisplay the window's overlay.