The viewport transformation is determined by the viewport's width and height in pixels, and , respectively, and its center (also in pixels). The vertex's window coordinates, , are given by

The factor and offset applied to encoded by **n** and **f** are set
using

` void` ** DepthRange** ( ` clampd` * n*, ` clampd` * f* ) ` ;`

Each of * n* and * f* are clamped to lie within ,
as are all arguments of type ` clampd` or ` clampf`.
is taken to be represented in fixed-point with at least
as many bits as there are in the depth buffer of the framebuffer.
We assume that the
fixed-point representation used represents each value
, where , as
**k** (e.g. 1.0 is represented in binary as a string of all ones).

Viewport transformation parameters are specified using

` void` ** Viewport** ( ` int` * x*, ` int` * y*, ` sizei` * w*, ` sizei` * h* ) ` ;`

where * x* and * y* give the **x** and **y**
window coordinates of the viewport's lower-left
corner
and * w* and * h* give the viewport's width and height, respectively.
The viewport parameters shown in the above equations are found from these
values as
and
;
, .

Viewport width and height are clamped to implementation-dependent maximums
when specified.
The maximum width and height may be found by issuing an appropriate
** Get** command (see Chapter 6).
The maximum viewport dimensions must be greater than or equal to
the visible dimensions of the display being rendered to.
` INVALID_VALUE` is generated if either * w* or * h* is negative.

The state required to implement the viewport transformation is 6
integers.
In the initial state,
* w* and * h* are set to the width and height,
respectively,
of the window into which the GL is to do its rendering.
and are set to and , respectively.
**n** and **f** are set to and , respectively.

Sat Mar 29 02:23:21 PST 1997