xenocara/doc/gl-docs/GL/gl/viewport.3gl
2006-11-29 17:00:35 +00:00

73 lines
1.8 KiB
Plaintext

'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 viewport.
.ds Xs 35742 4 viewport.gl
.TH GLVIEWPORT 3G
.SH NAME
.B "glViewport
\- set the viewport
.SH C SPECIFICATION
void \f3glViewport\fP(
GLint \fIx\fP,
.nf
.ta \w'\f3void \fPglViewport( 'u
GLint \fIy\fP,
GLsizei \fIwidth\fP,
GLsizei \fIheight\fP )
.fi
.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2x\fP\ \f2y\fP\ \ 'u
\f2x\fP, \f2y\fP
Specify the lower left corner of the viewport rectangle,
in pixels. The initial value is (0,0).
.TP
\f2width\fP, \f2height\fP
Specify the width and height
of the viewport.
When a GL context is first attached to a window,
\f2width\fP and \f2height\fP are set to the dimensions of that window.
.SH DESCRIPTION
\%\f3glViewport\fP specifies the affine transformation of $x$ and $y$ from
normalized device coordinates to window coordinates.
Let ($x sub nd$, $y sub nd$) be normalized device coordinates.
Then the window coordinates ($x sub w$, $y sub w$) are computed as follows:
.sp
.ce
.EQ
x sub w ~=~ ( x sub nd ~+~ 1 ) left ( "width" over 2 right ) ~+~ "x"
.EN
.sp
.ce
.EQ
y sub w ~=~ ( y sub nd ~+~ 1 ) left ( "height" over 2 right ) ~+~ "y"
.EN
.RE
.P
Viewport width and height are silently clamped
to a range that depends on the implementation.
To query this range, call \%\f3glGet\fP with argument
\%\f3GL_MAX_VIEWPORT_DIMS\fP.
.SH ERRORS
\%\f3GL_INVALID_VALUE\fP is generated if either \f2width\fP or \f2height\fP is negative.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glViewport\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.bp
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_VIEWPORT\fP
.br
\%\f3glGet\fP with argument \%\f3GL_MAX_VIEWPORT_DIMS\fP
.SH SEE ALSO
\%\f3glDepthRange(3G)\fP