GLSCISSOR(3G)

πŸ’… glScissor(3G) β€” like, the scissor box one πŸŽ€

okay bestie, buckle up, this is a page from the 3G manual (that's the OpenGL section of the man pages, iykyk) and it's about glScissor. It's short, it's iconic, it's literally the rectangle that decides which pixels are allowed to exist. Let's go ✨


🌸 NAME 🌸

glScissor β€” define the scissor box


🧚 C SPECIFICATION 🧚

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

That's the whole signature, no cap. Four args, all numbers, all important 🫢


πŸ“ PARAMETERS πŸ“

  • x, y β€” these two specify the lower left corner of the scissor box. Initially they're (0, 0), which is the classic "start at the bottom-left, main character energy" default.
  • width, height β€” these specify the width and height of the scissor box. And here's the cute part: when a GL context is first attached to a window, width and height are set to the dimensions of that window. Like, it just matches the window automatically at first. Obsessed πŸ’–

✨ DESCRIPTION ✨

So glScissor defines a rectangle β€” they call it the scissor box β€” and it lives in window coordinates. The first two arguments, x and y, specify the lower left corner of the box. width and height specify the width and height of the box. Boom, that's a rectangle 🌈

To enable and disable the scissor test, call glEnable() and

glDisable with argument GL_SCISSOR_TEST. (Yes, that's literally how it's written on the page β€” the sentence got split across a line break, she's fine, she's just dramatic 😭)

The test is initially disabled. While the test is enabled, only pixels that lie within the scissor box can be modified by drawing commands. Everything outside? Not invited to the party πŸ’€

Window coordinates have integer values at the shared corners of frame buffer pixels. So that means:

  • glScissor(0,0,1,1) allows modification of only the lower left pixel in the window β€” one single pixel, one single queen πŸ‘‘
  • glScissor(0,0,0,0) doesn't allow modification of any pixels in the window. Zero pixels. Nothing. The void. πŸ™ˆ

And when the scissor test is disabled, it is as though the scissor box includes the entire window β€” like the box just stretched out and took over the whole screen, which honestly is a mood πŸ¦‹


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_VALUE is generated if either width or height is negative.
fr fr, don't pass a negative size. That's a whole error, not a vibe. ⚠️

πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glGet() with argument GL_SCISSOR_BOX
  • glIsEnabled() with argument GL_SCISSOR_TEST

Use these to peek at the current scissor box and check whether the test is on. Slay 🌟


πŸ‘‘ VERSION SUPPORT πŸ‘‘

Here's the vibe check for glScissor across the OpenGL versions β€” the function name column is glScissor, and it's a full sweep:

was a table, now it's a list because we don't do tables here πŸ’…
  • Function / Feature Name: glScissor
  • 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: βœ”

Every column. Every check. She ate and left no crumbs 🍽️✨


πŸŽ€ SEE ALSO πŸŽ€

  • glEnable()
  • glViewport()

Go read those next, bestie, they're friends of hers 🫢


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

So the page lists COPYRIGHT twice β€” once with the license bit, once just the holders. Not me making the same joke twice, it's in the source, I promise 😭

okay that's the whole page!! luv u, go clip some rectangles πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

[FIXME: source] β€’ 08/09/2021 β€’ GLSCISSOR(3G) β€” that's the footer, mwah πŸ’‹

πŸ“¦ where this page comes from