GLVIEWPORT(3G)

πŸŽ€ GLVIEWPORT(3G) β€” glViewport: set the viewport πŸŽ€

okay bestie, this is the 3G manual page for glViewport, and the header’s manual tag is [FIXME: manual] β€” yes, still a FIXME, we love a work in progress πŸ’€ let’s get into it. ✨


✨ NAME ✨

glViewport β€” set the viewport πŸ’…


🧚 C SPECIFICATION πŸ’–

void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);

🌸 PARAMETERS 🌸

  • x, y β€” these specify the lower left corner of the viewport rectangle, in pixels. the initial value is (0,0) 🫢
  • width, height β€” these 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 ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so glViewport specifies the affine transformation of x and y from normalized device coordinates to window coordinates. Let x nd and y nd be normalized device coordinates. Then the window coordinates x w and 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. like, do not do that. 😭


πŸ”Ž ASSOCIATED GETS πŸ”Ž

  • glGet() with argument GL_VIEWPORT
  • glGet() with argument GL_MAX_VIEWPORT_DIMS

πŸ‘‘ VERSION SUPPORT πŸ‘‘

the grid’s header is Function / Feature Name versus OpenGL Version. the function / feature name is glViewport, and it gets a βœ” in every single listed version:

  • OpenGL 2.0 β€” βœ”
  • OpenGL 2.1 β€” βœ”
  • OpenGL 3.0 β€” βœ”
  • OpenGL 3.1 β€” βœ”
  • OpenGL 3.2 β€” βœ”
  • OpenGL 3.3 β€” βœ”
  • OpenGL 4.0 β€” βœ”
  • OpenGL 4.1 β€” βœ”
  • OpenGL 4.2 β€” βœ”
  • OpenGL 4.3 β€” βœ”
  • OpenGL 4.4 β€” βœ”
  • OpenGL 4.5 β€” βœ”

she ate and left no crumbs. πŸ‘‘βœ¨


🌈 SEE ALSO 🌈

glDepthRange()


Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2010-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/. 🫢


Copyright Β© 1991-2006 Silicon Graphics, Inc.

Copyright Β© 2010-2014 Khronos Group


okay bestie, that’s the whole page 🫢 source/version: [FIXME: source] Β· date: 08/09/2021 Β· manual: GLVIEWPORT(3G) β€” mwah, go set that viewport πŸ’–βœ¨

πŸ“¦ where this page comes from