Viewport Coordinates

The default viewport coordinate system is identical to the physical screen coordinate system. The _setviewport function creates a new viewport within the boundaries of the physical screen. A standard viewport has two distinguishing features:

The origin of a viewport initially lies in the upper-left corner of the viewport, not the upper-left corner of the physical screen.

The clipping region matches the outer boundaries of the viewport.

In other words, the _setviewport function does the same thing as would two separate calls to _setvieworg and _setcliprgn. All graphics output functions require values that are either viewport coordinates or window coordinates.

For example,

_setviewport( 50, 50, 200, 100 );

creates the viewport illustrated in Figure 9.3. The values passed to the _setviewport function are physical screen locations of opposite corners. After the viewport is created, the viewport origin lies in the upper-left corner.