CS 457/557 -- Winter Quarter 2017

Project #5

Image Manipulation in a "Magic Lens"

100 Points

Due: February 27

This page was last updated: February 14, 2017


  1. In computer graphics (and especially in visualization), there is a technique called a Magic Lens. A Magic Lens is some shape, usually a rectangle or circle, in which a different version of the display is drawn. Your job is to create a Magic Lens for an image display. Inside the Magic Lens, the image needs to be able to be magnified, rotated, and sharpened.

  2. Draw a QuadXY.

  3. Map an image to it using a 2D Texture.

  4. Your GLIB file could look something like this:
    ##OpenGL GLIB
    Ortho -5. 5.   -5. 5.
    LookAt 0 0 2  0 0 0  0 1 0
    Texture2D 5 image.bmp
    Vertex   mag.vert
    Fragment mag.frag
    Program  Mag						\
    	uScenter <0. .5 1.>				\
    	uTcenter <0. .5 1.>				\
    	uDs      <0.01 .1 .5>				\
    	uDt      <0.01 .1 .5>				\
    	uMagFactor <.1 1. 25.>				\
    	uRotAngle <-3.14159 0. 3.14159>			\
    	uSharpFactor <0. 1. 5.>				\
    	uImageUnit  5
    QuadXY .2 5.

  5. (uScenter,uTcenter) are the (s,t) coordinates of the center of the Magic Lens rectangle.

  6. (uDs,uDt) are the sizes of the Magic Lens rectangle.


Extra Credit (+5 Points)

Make the Magic Lens a circle instead of the rectangle. The center will still be given the same way, will use a radius slider instead of two rectangle dimansion sliders.

The Turn-In Process:

  1. Your turnin will be done at http://engr.oregonstate.edu/teach and will consist of:
    1. All source files (.glib, .vert, .frag)
    2. The original image file you used.
    3. Your PDF report.

  2. You can use the kec.bmp image for testing, but what you show in your report needs to be an image of your own. (Remember, on some graphics systems, the dimensions of that image need to be even powers of two. This is not true in the CGEL.)

  3. Your PDF report will consist of:
    1. A cover page (name, Project #6)
    2. Source listings (.glib, .vert, .frag)
    3. A prose explanation of what you did.
    4. Four or more color images showing what your results were (original, magnified, rotated, sharpened).
    5. If you did the Extra Credit, then also include at least one image exhibiting your circular Magic Lens.

    Be sure that your PDF file is turned-in separately (not part of a .zip file).



Something different happens in a rectangle20
The rectangle can be sized and moved20
Magnification works20
Rotation works20
Sharpening works20
Circle Extra Credit5
Potential Total105