GLUSCALEIMAGE(3G)

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

✨ GLUSCALEIMAGE(3G) ✨

okay so bestie, welcome to gluScaleImage β€” that's the 3G manual page, the GLU utility girlies πŸ’…. she takes an image and rescales it to literally whatever size you want. no cap.


πŸŽ€ C SPECIFICATION πŸŽ€

GLint gluScaleImage( GLenum format,
                     GLsizei wIn,
                     GLsizei hIn,
                     GLenum typeIn,
                     const void *dataIn,
                     GLsizei wOut,
                     GLsizei hOut,
                     GLenum typeOut,
                     GLvoid* dataOut )

🌸 PARAMETERS 🌸

  • format β€” Specifies the ____ of the pixel data. (ngl the original page literally has a hole here, it's giving typo 😭 β€” anyway, these are the symbolic values that are valid: GL_COLOR_INDEX, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, GL_BGR, GL_BGRA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.)
  • wIn, hIn β€” the width and height of the source image, in pixels. that's your starting canvas πŸ–ΌοΈ
  • typeIn β€” the data type for dataIn. it must be one of 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. pick one or she's not playing πŸ’€
  • dataIn β€” a pointer to the source image. where the pixels live.
  • wOut, hOut β€” the width and height of the destination image, in pixels. the glow-up dimensions ✨
  • typeOut β€” the data type for dataOut. must be one of 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, or GL_UNSIGNED_INT_2_10_10_10_REV. (spot the difference: that last one is an or, not an and β€” iconique of the original, we keep it exactly 🫢)
  • dataOut β€” a pointer to the destination image. where the new pixels get written.

πŸ¦‹ DESCRIPTION πŸ¦‹

gluScaleImage scales a pixel image. she uses the appropriate pixel store modes to unpack data out of the source image and pack data into the destination image. unpack, repack, serve πŸ’–

When you're shrinking an image, gluScaleImage uses a box filter to sample the source image and create pixels for the destination image. tiny but make it make sense.

When you're magnifying an image, the pixels from the source image get linearly interpolated to create the destination image. glow up, but math 🧚

A return value of zero indicates success. anything else means a GLU error code came back β€” go check gluErrorString for the tea.

Also, see the glReadPixels reference page for a description of the acceptable values for the format, typeIn, and typeOut parameters. she's the source of truth, periodt.


πŸ’… NOTES πŸ’…

Formats GL_BGR, and GL_BGRA, and types 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 are only available if the GL version is 1.2 or greater. so if you're on something ancient, these are not for you πŸ™ˆ


πŸ’€ ERRORS πŸ’€

  • GLU_INVALID_VALUE is returned if wIn, hIn, wOut, or hOut is negative. negative pixels aren't a vibe.
  • GLU_INVALID_ENUM is returned if format, typeIn, or typeOut is not legal. no fake enums in this house.
  • GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_BYTE_3_3_2 or GL_UNSIGNED_BYTE_2_3_3_REV and format is not GL_RGB.
  • GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_SHORT_5_6_5 or GL_UNSIGNED_SHORT_5_6_5_REV and format is not GL_RGB.
  • GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_4_4_4_4_REV and format is neither GL_RGBA nor GL_BGRA.
  • GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_SHORT_5_5_5_1 or GL_UNSIGNED_SHORT_1_5_5_5_REV and format is neither GL_RGBA nor GL_BGRA.
  • GLU_INVALID_OPERATION is returned if typeIn or typeOut is GL_UNSIGNED_INT_8_8_8_8 or GL_UNSIGNED_INT_8_8_8_8_REV and format is neither GL_RGBA nor GL_BGRA.
  • GLU_INVALID_OPERATION is returned if typeIn or typeOut is 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 like… pack your types to match your format or she WILL hand you GLU_INVALID_OPERATION, and it will be deserved πŸ”₯

🌈 SEE ALSO 🌈

glDrawPixels(3G), glReadPixels(3G), gluBuild1DMipmaps(3G), gluBuild2DMipmaps(3G), gluBuild3DMipmaps(3G), gluErrorString(3G)


and that's the whole page, bestie πŸ’œ this one signs off as GLUSCALEIMAGE(3G) β€” that's the source and the version tag and the date energy all rolled into one iconic little line at the bottom. go scale something huge, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from