1. Control is passed back by calling callback functions set up by the programmer on specific events. This is set up by registering the callbacks to events during initialization (eg, glutDisplayFunc).

2. Sets RGBA color instead of indexed color and sets double-buffering instead of single.

3. glOrtho sets the view volume to range from (0,0,-1) to (1,1,1). glViewport sets the OpenGL rendering area in the window to range from (0,0) to (w,h).

Submitted code

The program draws a graph of sin(x) from -pi to pi at varying levels of resolution. The default takes 41 samples along the x-axis and draws the function using GL_LINE_STRIP. The sampling resolution is user-adjustable; also, the user can choose a filled version of the graph, instead of an outline.

  • To increase sampling resolution press '+'
  • To decrease sampling resolution press '-'
  • To select filled mode (using GL_TRIANGLE_FAN), press 'f'
  • To quit, press ESC