logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

glViewport - set the viewport

Associated Gets

glGet() with argument GL_VIEWPORTglGet() with argument GL_MAX_VIEWPORT_DIMS

C Specification

voidglViewport(GLintx,GLinty,GLsizeiwidth,GLsizeiheight);

Description

glViewport specifies the affine transformation of x and y from normalized device coordinates to window
       coordinates. Let x nd y nd be normalized device coordinates. Then the window coordinates x w y w are
       computed as follows:

       x w = x nd + 1 ⁢ width 2 + x

       y w = y nd + 1 ⁢ height 2 + y

       Viewport width and height are silently clamped to a range that depends on the implementation. To query
       this range, call glGet() with argument GL_MAX_VIEWPORT_DIMS.

Errors

GL_INVALID_VALUE is generated if either width or height is negative.

Name

       glViewport - set the viewport

Parameters

x, y
           Specify the lower left corner of the viewport rectangle, in pixels. The initial value is (0,0).

       width, height
           Specify the width and height of the viewport. When a GL context is first attached to a window, width
           and height are set to the dimensions of that window.

See Also

glDepthRange()

Version Support

       ┌────────────┬───────────────────────────────────────────────────────────────────────┐
       │            │                OpenGLVersion                                         │
       ├────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
       │ Function2.02.13.03.13.23.34.04.14.24.34.44.5 │
       │ /          │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Feature    │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Name       │     │     │     │     │     │     │     │     │     │     │     │     │
       ├────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glViewport │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
       └────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

See Also