2D Viewing Transformation: Viewport

The user may want to create images on different parts of the screen so we define a viewport in Normalized Device Coordinates (NDC). Using NDC also allows for output device independence. Later we will map from NDC to Physical Device Coordinates (PDC).

Normalized Device Coordinates: Let the entire display surface have coordinate values
0.0 <= x,y <= 1.0
Command: Set_viewport2(Xvmin,Xvmax,Yvmin,Yvmax)
 

Examples

To draw in bottom 1/2 of screen Set_viewport2( 0.0, 1.0, 0.0, 0.5)
To draw in upper right hand corner: Set_viewport2( 0.5, 1.0, 0.5, 1.0 )

Can display multiple images in different viewports:

Set_window( -30, +30, -15, +15);
Set_viewport(0.0, 0.5, 0.0, 0.5); -- lower left
Draw_house;
Set_viewport(0.5, 1.0, 0.0, 0.5); -- lower right
Draw_house;
Set_viewport(0.0, 0.5, 0.5, 1.0); -- upper left
Draw_house;
Set_viewport( 0.5, 1.0, 0.5, 1.0); -- upper right
Draw_house;
This gives the following image:


2D Viewing Transformation Main page
HyperGraph Table of Contents.
HyperGraph Home page.

Last changed September 30, 1998, G. Scott Owen, owen@siggraph.org