GLGETCOLORTABLE(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

πŸ’– glGetColorTable β€” it's in the 3G manual bestie, and it's giving color lookup table energy

✨ NAME ✨

glGetColorTable β€” grab the entire contents of a color lookup table and yeet them into your buffer πŸŽ€


🌸 C SPECIFICATION 🌸

void glGetColorTable( GLenum target,
                      GLenum format,
                      GLenum type,
                      GLvoid *table )

πŸ¦‹ PARAMETERS πŸ¦‹

  • target β€” okay so this has to be one of exactly three things: GL_COLOR_TABLE, GL_POST_CONVOLUTION_COLOR_TABLE, or GL_POST_COLOR_MATRIX_COLOR_TABLE. That's it. Those are the vibes allowed πŸ’…
  • format β€” the format of the pixel data in table. The possible values are GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_BGR, GL_RGBA, and GL_BGRA. Pick one, queen πŸ‘‘
  • type β€” the type of the pixel data in table. These symbolic constants are all accepted: 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 a lot of options and honestly? slay 🌈
  • table β€” a pointer to a one-dimensional array of pixel data that's gonna hold the contents of the color table. This is where the goodies land πŸ“

πŸ’œ DESCRIPTION πŸ’œ

So glGetColorTable returns, in table, the contents of the color table that target is pointing at. No pixel transfer operations get performed, okay? None. But the pixel storage modes that apply to glReadPixels do get performed. iykyk ✨

Here's the tea: color components you ask for in the specified format, but which aren't actually included in the internal format of the color lookup table, come back as zero. Sorry bestie, that's just how it is 😭

And here's how the internal color components map onto the components requested by format:

  • internal red β†’ resulting red
  • internal green β†’ resulting green
  • internal blue β†’ resulting blue
  • internal alpha β†’ resulting alpha
  • internal luminance β†’ resulting red
  • internal intensity β†’ resulting red

Like, luminance and intensity both just slide into the red slot. main character behavior fr fr πŸ‘‘


πŸŽ€ NOTES πŸŽ€

glGetColorTable only exists if GL_ARB_imaging shows up when you call glGetString with an argument of GL_EXTENSIONS. No GL_ARB_imaging, no function. Vibe check failed, sorry 🫢


πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_ENUM gets generated if target isn't one of the allowable values. Rude, but valid 🚫
  • GL_INVALID_ENUM gets generated if format isn't one of the allowable values.
  • GL_INVALID_ENUM gets generated if type isn't one of the allowable values.
  • GL_INVALID_OPERATION gets generated if type 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. Those types are GL_RGB-only, periodt πŸ’€
  • GL_INVALID_OPERATION gets generated if type 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. So it's RGBA or BGRA or nothing, no in-between πŸ™ˆ
  • GL_INVALID_OPERATION gets generated if glGetColorTable gets executed between the execution of glBegin and the corresponding execution of glEnd. Do not do that. Not the moment, not the vibe 🚫

🌟 SEE ALSO 🌟

  • glColorTable(3G)
  • glColorTableParameter(3G)
  • glGetColorTableParameter(3G)

okay that's the whole page bestie, you ate it, go forth and fetch those color tables πŸ’–βœ¨

This little legend lives in the 3G manual under the very iconic name GLGETCOLORTABLE(3G) β€” that's the source/version and the date wrapped up together, so consider this your cute sign-off. byeeee πŸ¦‹πŸŽ€πŸ’…

πŸ“¦ where this page comes from