GLGETMINMAX(3G)

πŸ“¦ version 1.1, in centos-stream 9, fedora 43, fedora 44

πŸ’– NAME πŸ’–

glGetMinmax β€” bestie, this one grabs your minimum and maximum pixel values for you ✨

It lives in the 3G manual, and yes she's iconic for it.


🌸 C SPECIFICATION 🌸

void glGetMinmax( GLenum target,
                  GLboolean reset,
                  GLenum format,
                  GLenum types,
                  GLvoid *values )

πŸŽ€ PARAMETERS πŸŽ€

  • target β€” has got to be GL_MINMAX. No substitutions, no vibes, just GL_MINMAX.
  • reset β€” if you pass GL_TRUE, every entry in the minmax table that actually gets returned is reset back to its initial values (the other entries? untouched, she's not touching them πŸ™…). If you pass GL_FALSE, the minmax table stays completely unaltered.
  • format β€” this is what format the data comes back in, inside values. It has to be one of: GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_BGR, GL_RGBA, GL_BGRA, GL_LUMINANCE, or GL_LUMINANCE_ALPHA.
  • types β€” the type of the data that comes back in values. These are the accepted ones: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, and GL_UNSIGNED_INT_2_10_10_10_REV. That's the whole guest list πŸ’…
  • values β€” a pointer to storage where the returned values go. You gotta have somewhere to put them, bestie.

πŸ¦‹ DESCRIPTION πŸ¦‹

So glGetMinmax hands you back the accumulated minimum and maximum pixel values β€” and it computes those on a per-component basis, no cap. They come back as a one-dimensional image of width 2. First set of return values? That's the minima. Second set? The maxima. The format of what you get back is decided by format, and the type of what you get back is decided by types.

Real talk though: no pixel transfer operations get performed on the return values. None. But the pixel storage modes that apply to 1-dimensional images do get performed, so don't forget about those.

Here's the little quirk that gets everybody: if you request color components in format that aren't actually included in the internal format of the minmax table, they come back as zero. Zero. Nothing. Empty. 😭

And the assignment of internal color components to the components you request with format goes like this:

  • Red internal β†’ Red resulting
  • Green internal β†’ Green resulting
  • Blue internal β†’ Blue resulting
  • Alpha internal β†’ Alpha resulting
  • Luminance internal β†’ Red resulting

If reset is GL_TRUE, the minmax table entries that correspond to the return values get reset to their initial values. And listen β€” minimum and maximum values that are not returned are not modified, even when reset is GL_TRUE. She only touches what she shows you 🫢


⭐ NOTES ⭐

glGetMinmax is only present if GL_ARB_imaging shows up when glGetString is called with an argument of GL_EXTENSIONS. So like, vibe check first, okay?


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_ENUM gets generated if target is not GL_MINMAX.
  • GL_INVALID_ENUM gets generated if format is not one of the allowable values.
  • GL_INVALID_ENUM gets generated if types is not one of the allowable values.
  • GL_INVALID_OPERATION gets generated if glGetMinmax is executed between the execution of glBegin and the corresponding execution of glEnd. Do not do that. Ma'am. πŸ™ˆ
  • GL_INVALID_OPERATION gets generated if types is one of GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format is not GL_RGB.
  • GL_INVALID_OPERATION gets generated if types is one of GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV and format is neither GL_RGBA nor GL_BGRA.
Mixing and matching those type/format combos wrong is a whole mood, and that mood is GL_INVALID_OPERATION. Match them up correctly and you ate. πŸ”₯

🌈 SEE ALSO 🌈

  • glMinmax(3G)
  • glResetMinmax(3G)
  • glGetMinmaxParameter(3G)

And that's the whole page, bestie πŸ’œ this was GLGETMINMAX(3G) from the 3G manual β€” she's a classic, she's serving, and now you know her fr fr. Go get those min and max values πŸ‘‘βœ¨

πŸ“¦ where this page comes from