WEEK 2:  September 15 - September 21

OUTLINE:

Using the Mouse Button for Plotting Points

  • Registering the callback for the mouse
  • Determing the state of the button
  • Converting the y value
  • Choosing the frame to coincide with the window

Using pixel coordinates rather than real world coordinates

  • Using glOrtho to specify the screen window
  • Introduction to scan-line algorithms

Raster Displays

World Windows (Frame) and Screen Windows

  • When the frame and the screen window should be the same:
    • using pixels to correspond to points

World Windows (Frame) and Viewports

  • Mapping from (World) Frame to Entire (Screen) Window
    • The math behind the Frame to Window transformation
  • Mapping from (World) Frame to a Viewport (Part of a Window)
  • World Windows (Frame) and Screen Windows
    • Aspect Ratio of the Frame
    • Aspect Ratio of the Screen Window
    • Preserving Aspect Ratio
      • via choosing the dimensions of the screen window
      • via choosing the larger dimension of the screen window and forcing the choice of the other dimension
      • via automatically using a viewport that preserves aspect ratio
  • Using the reshaping function

Making the primitive drawing commands more user-friendly

Making the window and viewport commands more user-friendly

  • the window class
  • the frame class
  • the setVP function
  • the autoViewPort function

The TUGL collection - putting it all together

Using Multiple Windows

Managing Projects in Graphics with makefile

 


REFERENCE(S):

Computer Graphics Using OpenGL, 3rd Edition (Hill):
      Chapter 9 (9.4 - Bresenham's Algorithm)
      Chapter 3 (3.1, 3.2 - Window to Viewport Mapping)

   
     

OpenGL Manual/v.1.2: Chapter 2 (p. 27 - 64); Chapter 3 (p.126)

GLUT Programming Interface: Chapters 1 - 4

DEMOS and FILES:

/classes/cs3014/files/week2/multiplewin.cpp
/classes/cs3014/files/week2/horiz_stripes.cpp
/classes/cs3014/files/week2/horiz_stripes2.cpp

/classes/cs3014/files/week2/point_class1.cpp
/classes/cs3014/files/week2/point_class2.cpp

Optional:

/classes/cs3014/files/week2/glui_demo1.cpp
/classes/cs3014/files/week2/glui_demo1b.cpp
/classes/cs3014/files/week2/glui_demo1c.cpp
/classes/cs3014/files/week2/glui_demo1d.cpp

EXERCISES: CLICK FOR PRINTABLE VERSION OF EXERCISES