GLPIXELTRANSFER(3G)
π GLPIXELTRANSFER(3G) π
okay so hi bestie, this is the manual page for glPixelTransferf and glPixelTransferi β yes both of them, they're twinsies, one takes floats one takes ints, we'll get there. grab a snack, this one's a long one. π
β¨ NAME β¨
glPixelTransferf, glPixelTransferi β set pixel transfer modes
no cap, that's the whole name section, it's giving minimalism π
πΈ C SPECIFICATION πΈ
void glPixelTransferf( GLenum pname,
GLfloat param )
void glPixelTransferi( GLenum pname,
GLint param )
also there's a lildelim $$sitting in the original right under this, which is just the troff girlies setting up their math delimiters so the$...$formulas later actually render. iconic behavior, we love to see it. π
π PARAMETERS π
pnameβ the symbolic name of the pixel transfer parameter you're setting, bestie. It has to be one of these, no substitutes:GL_MAP_COLOR,GL_MAP_STENCIL,GL_INDEX_SHIFT,GL_INDEX_OFFSET,GL_RED_SCALE,GL_RED_BIAS,GL_GREEN_SCALE,GL_GREEN_BIAS,GL_BLUE_SCALE,GL_BLUE_BIAS,GL_ALPHA_SCALE,GL_ALPHA_BIAS,GL_DEPTH_SCALE, orGL_DEPTH_BIAS.
and β plot twist β if the GL_ARB_imaging extension is supported, these symbolic names are accepted too: GL_POST_COLOR_MATRIX_RED_SCALE, GL_POST_COLOR_MATRIX_GREEN_SCALE, GL_POST_COLOR_MATRIX_BLUE_SCALE, GL_POST_COLOR_MATRIX_ALPHA_SCALE, GL_POST_COLOR_MATRIX_RED_BIAS, GL_POST_COLOR_MATRIX_GREEN_BIAS, GL_POST_COLOR_MATRIX_BLUE_BIAS, GL_POST_COLOR_MATRIX_ALPHA_BIAS, GL_POST_CONVOLUTION_RED_SCALE, GL_POST_CONVOLUTION_GREEN_SCALE, GL_POST_CONVOLUTION_BLUE_SCALE, GL_POST_CONVOLUTION_ALPHA_SCALE, GL_POST_CONVOLUTION_RED_BIAS, GL_POST_CONVOLUTION_GREEN_BIAS, GL_POST_CONVOLUTION_BLUE_BIAS, and GL_POST_CONVOLUTION_ALPHA_BIAS. πβ¨
paramβ the value thatpnamegets set to. that's it. that's the whole job. π«Ά
π¦ DESCRIPTION π¦
okay so glPixelTransfer sets the pixel transfer modes β and those modes change how a whole stack of later commands behave: glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawPixels, glReadPixels, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D. that's the list, we don't skip entries in this house π
and if the GL_ARB_imaging subset is supported, these routines are affected as well: glColorTable, glColorSubTable, glConvolutionFilter1D, glConvolutionFilter2D, glHistogram, glMinmax, and glSeparableFilter2D. π₯
the algorithms that the pixel transfer modes specify operate on pixels after they're read from the frame buffer β that's glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, and glReadPixels β or after they're unpacked from client memory β that's glDrawPixels, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D. π§
the way the pixel transfer operations happen? same order, same manner, every single time, no matter which command kicked off the pixel operation. it's consistent, it's reliable, it's the main character of the pipeline. π
meanwhile, pixel storage modes (peep glPixelStore) are a whole different thing β those control the unpacking of pixels being read from client memory, and the packing of pixels being written back into client memory. two separate systems bestie, don't mix them up. π
π the four fundamental pixel types π
pixel transfer operations handle four fundamental pixel types: color, color index, depth, and stencil.
- color β four floating-point values, with unspecified mantissa and exponent sizes, scaled such that
0represents zero intensity and1represents full intensity. β¨ - color index β a single fixed-point value, with unspecified precision to the right of the binary point. π
- depth β a single floating-point value, with unspecified mantissa and exponent sizes, scaled such that
0.0represents the minimum depth buffer value, and1.0represents the maximum depth buffer value. π - stencil β a single fixed-point value, with unspecified precision to the right of the binary point. π
and now, the pixel transfer operations performed on those four basic pixel types, one by one, no skipping:
π Color π
each of the four color components gets multiplied by a scale factor, then added to a bias factor. literally:
- red gets multiplied by
GL_RED_SCALE, then added toGL_RED_BIAS - green gets multiplied by
GL_GREEN_SCALE, then added toGL_GREEN_BIAS - blue gets multiplied by
GL_BLUE_SCALE, then added toGL_BLUE_BIAS - alpha gets multiplied by
GL_ALPHA_SCALE, then added toGL_ALPHA_BIAS
after all four color components are scaled and biased, each one is clamped to the range [0,1]. all the color, scale, and bias values are specified with glPixelTransfer. π
now, if GL_MAP_COLOR is true β each color component gets scaled by the size of the corresponding color-to-color map, then replaced by the contents of that map indexed by the scaled component. so:
- red is scaled by
GL_PIXEL_MAP_R_TO_R_SIZE, then replaced by the contents ofGL_PIXEL_MAP_R_TO_Rindexed by itself - green is scaled by
GL_PIXEL_MAP_G_TO_G_SIZE, then replaced by the contents ofGL_PIXEL_MAP_G_TO_Gindexed by itself - blue is scaled by
GL_PIXEL_MAP_B_TO_B_SIZE, then replaced by the contents ofGL_PIXEL_MAP_B_TO_Bindexed by itself - alpha is scaled by
GL_PIXEL_MAP_A_TO_A_SIZE, then replaced by the contents ofGL_PIXEL_MAP_A_TO_Aindexed by itself
all components taken from the maps are then clamped to the range [0,1]. GL_MAP_COLOR is specified with glPixelTransfer. the contents of the various maps are specified with glPixelMap. πΊοΈβ¨
if the GL_ARB_imaging extension is supported, each of the four color components may be scaled and biased after transformation by the color matrix. that means:
- red is multiplied by
GL_POST_COLOR_MATRIX_RED_SCALE, then added toGL_POST_COLOR_MATRIX_RED_BIAS - green is multiplied by
GL_POST_COLOR_MATRIX_GREEN_SCALE, then added toGL_POST_COLOR_MATRIX_GREEN_BIAS - blue is multiplied by
GL_POST_COLOR_MATRIX_BLUE_SCALE, then added toGL_POST_COLOR_MATRIX_BLUE_BIAS - alpha is multiplied by
GL_POST_COLOR_MATRIX_ALPHA_SCALE, then added toGL_POST_COLOR_MATRIX_ALPHA_BIAS
after all four color components are scaled and biased, each is clamped to the range [0,1]. π€
similiarly (yes, that's how it's spelled in the original, we're keeping it, no notes π) β if the GL_ARB_imaging extension is supported, each of the four color components may be scaled and biased after processing by the enabled convolution filter:
- red is multiplied by
GL_POST_CONVOLUTION_RED_SCALE, then added toGL_POST_CONVOLUTION_RED_BIAS - green is multiplied by
GL_POST_CONVOLUTION_GREEN_SCALE, then added toGL_POST_CONVOLUTION_GREEN_BIAS - blue is multiplied by
GL_POST_CONVOLUTION_BLUE_SCALE, then added toGL_POST_CONVOLUTION_BLUE_BIAS - alpha is multiplied by
GL_POST_CONVOLUTION_ALPHA_SCALE, then added toGL_POST_CONVOLUTION_ALPHA_BIAS
after all four color components are scaled and biased, each is clamped to the range [0,1]. periodt. π«Ά
π Color index π
each color index gets shifted left by GL_INDEX_SHIFT bits, and any bits beyond the number of fraction bits carried by the fixed-point index are filled with zeros. if GL_INDEX_SHIFT is negative, the shift goes to the right instead, again zero filled. β¨
then GL_INDEX_OFFSET is added to the index. both GL_INDEX_SHIFT and GL_INDEX_OFFSET are specified with glPixelTransfer. π
from this point, the operation diverges depending on the required β£ of the resulting pixels β yeah there's literally a missing word in the original there, we're not fixing it, we're respecting the artifact π β so, the branch:
- if the resulting pixels are to be written to a color index buffer, or if they're being read back to client memory in
GL_COLOR_INDEX, the pixels keep being treated as indices. and ifGL_MAP_COLORis true, each index is masked by $2 sup n ~-~ 1$, where $n$ isGL_PIXEL_MAP_I_TO_I_SIZE, then replaced by the contents ofGL_PIXEL_MAP_I_TO_Iindexed by the masked value.GL_MAP_COLORis specified withglPixelTransfer. the contents of the index map is specified withglPixelMap. πΊοΈ - if the resulting pixels are to be written to an RGBA color buffer, or if they're read back to client memory in anything other than
GL_COLOR_INDEX, the pixels get converted from indices to colors by referencing the four mapsGL_PIXEL_MAP_I_TO_R,GL_PIXEL_MAP_I_TO_G,GL_PIXEL_MAP_I_TO_B, andGL_PIXEL_MAP_I_TO_A. before being dereferenced, the index is masked by $2 sup n ~-~ 1$, where $n$ is:GL_PIXEL_MAP_I_TO_R_SIZEfor the red mapGL_PIXEL_MAP_I_TO_G_SIZEfor the green mapGL_PIXEL_MAP_I_TO_B_SIZEfor the blue mapGL_PIXEL_MAP_I_TO_A_SIZEfor the alpha map
all components taken from the maps are then clamped to the range [0,1]. the contents of the four maps is specified with glPixelMap. π
π¦ Depth π¦
each depth value is multiplied by GL_DEPTH_SCALE, added to GL_DEPTH_BIAS, then clamped to the range [0,1]. three steps, that's the whole vibe. π«§
π§ Stencil π§
each index is shifted GL_INDEX_SHIFT bits just like a color index is, then added to GL_INDEX_OFFSET. and if GL_MAP_STENCIL is true, each index is masked by $2 sup n ~-~ 1$, where $n$ is GL_PIXEL_MAP_S_TO_S_SIZE, then replaced by the contents of GL_PIXEL_MAP_S_TO_S indexed by the masked value. π
and then β bestie, we're not done β the original says:
the following table gives the type, initial value, and range of valid values for each of the pixel transfer parameters that are set with glPixelTransfer.
and that table is coming right up in the next part, so don't go anywhere πβ¨
okay so here's the whole roster of pixel-transfer knobs you can pass as pname β every one of them, with its type, its starting value, and the range it's allowed to vibe in π:
GL_MAP_COLORβ it's a boolean, starts out asfalse, and its valid range istrue/false.GL_MAP_STENCILβ also a boolean, defaulting tofalse, valid rangetrue/false.GL_INDEX_SHIFTβ an integer, initial value0, valid range(-β,β).GL_INDEX_OFFSETβ integer, starts at0, valid range(-β,β).GL_RED_SCALEβ float, initial value1, valid range(-β,β).GL_GREEN_SCALEβ float, initial value1, valid range(-β,β).GL_BLUE_SCALEβ float, initial value1, valid range(-β,β).GL_ALPHA_SCALEβ float, initial value1, valid range(-β,β).GL_DEPTH_SCALEβ float, initial value1, valid range(-β,β).GL_RED_BIASβ float, initial value0, valid range(-β,β).GL_GREEN_BIASβ float, initial value0, valid range(-β,β).GL_BLUE_BIASβ float, initial value0, valid range(-β,β).GL_ALPHA_BIASβ float, initial value0, valid range(-β,β).GL_DEPTH_BIASβ float, initial value0, valid range(-β,β).GL_POST_COLOR_MATRIX_RED_SCALEβ float, initial value1, valid range(-β,β).GL_POST_COLOR_MATRIX_GREEN_SCALEβ float, initial value1, valid range(-β,β).GL_POST_COLOR_MATRIX_BLUE_SCALEβ float, initial value1, valid range(-β,β).GL_POST_COLOR_MATRIX_ALPHA_SCALEβ float, initial value1, valid range(-β,β).GL_POST_COLOR_MATRIX_RED_BIASβ float, initial value0, valid range(-β,β).GL_POST_COLOR_MATRIX_GREEN_BIASβ float, initial value0, valid range(-β,β).GL_POST_COLOR_MATRIX_BLUE_BIASβ float, initial value0, valid range(-β,β).GL_POST_COLOR_MATRIX_ALPHA_BIASβ float, initial value0, valid range(-β,β).GL_POST_CONVOLUTION_RED_SCALEβ float, initial value1, valid range(-β,β).GL_POST_CONVOLUTION_GREEN_SCALEβ float, initial value1, valid range(-β,β).GL_POST_CONVOLUTION_BLUE_SCALEβ float, initial value1, valid range(-β,β).GL_POST_CONVOLUTION_ALPHA_SCALEβ float, initial value1, valid range(-β,β).GL_POST_CONVOLUTION_RED_BIASβ float, initial value0, valid range(-β,β).GL_POST_CONVOLUTION_GREEN_BIASβ float, initial value0, valid range(-β,β).GL_POST_CONVOLUTION_BLUE_BIASβ float, initial value0, valid range(-β,β).GL_POST_CONVOLUTION_ALPHA_BIASβ float, initial value0, valid range(-β,β).
and fr fr, glPixelTransferf can set any pixel transfer parameter. if the parameter type is boolean, then 0 means false and literally any other value means true. and if pname is an integer parameter, param gets rounded to the nearest integer. β¨
same energy with glPixelTransferi β it can also set any of the pixel transfer parameters. boolean parameters go false when param is 0 and true otherwise. and before param gets assigned to any real-valued parameter, it's converted to floating point. π
π NOTES π
okay bestie, listen up, this part matters π
if a glColorTable, glColorSubTable, glConvolutionFilter1D, glConvolutionFilter2D, glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawPixels, glReadPixels, glSeparableFilter2D, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, or glTexSubImage3D command gets placed in a display list (peep glNewList and glCallList), then the pixel transfer mode settings that are in effect when the display list is executed are the ones that actually get used. and yes, those can absolutely be different from the settings that were active when the command was compiled into the display list. no cap. π
π¨ ERRORS π¨
GL_INVALID_ENUMgets generated ifpnameis not an accepted value. π ββοΈGL_INVALID_OPERATIONgets generated ifglPixelTransferis executed between the execution ofglBeginand the corresponding execution ofglEnd. don't do that bestie, that's illegal behavior π
π ASSOCIATED GETS π
glGetwith argumentGL_MAP_COLORglGetwith argumentGL_MAP_STENCILglGetwith argumentGL_INDEX_SHIFTglGetwith argumentGL_INDEX_OFFSETglGetwith argumentGL_RED_SCALEglGetwith argumentGL_RED_BIASglGetwith argumentGL_GREEN_SCALEglGetwith argumentGL_GREEN_BIASglGetwith argumentGL_BLUE_SCALEglGetwith argumentGL_BLUE_BIASglGetwith argumentGL_ALPHA_SCALEglGetwith argumentGL_ALPHA_BIASglGetwith argumentGL_DEPTH_SCALEglGetwith argumentGL_DEPTH_BIASglGetwith argumentGL_POST_COLOR_MATRIX_RED_SCALEglGetwith argumentGL_POST_COLOR_MATRIX_RED_BIASglGetwith argumentGL_POST_COLOR_MATRIX_GREEN_SCALEglGetwith argumentGL_POST_COLOR_MATRIX_GREEN_BIASglGetwith argumentGL_POST_COLOR_MATRIX_BLUE_SCALEglGetwith argumentGL_POST_COLOR_MATRIX_BLUE_BIASglGetwith argumentGL_POST_COLOR_MATRIX_ALPHA_SCALEglGetwith argumentGL_POST_COLOR_MATRIX_ALPHA_BIASglGetwith argumentGL_POST_CONVOLUTION_RED_SCALEglGetwith argumentGL_POST_CONVOLUTION_RED_BIASglGetwith argumentGL_POST_CONVOLUTION_GREEN_SCALEglGetwith argumentGL_POST_CONVOLUTION_GREEN_BIASglGetwith argumentGL_POST_CONVOLUTION_BLUE_SCALEglGetwith argumentGL_POST_CONVOLUTION_BLUE_BIASglGetwith argumentGL_POST_CONVOLUTION_ALPHA_SCALEglGetwith argumentGL_POST_CONVOLUTION_ALPHA_BIAS
π SEE ALSO π
glCallList(3G)glColorTable(3G)glColorSubTable(3G)glConvolutionFilter1D(3G)glConvolutionFilter2D(3G)glCopyPixels(3G)glCopyTexImage1D(3G)glCopyTexImage2D(3G)glCopyTexSubImage1D(3G)glCopyTexSubImage2D(3G)glCopyTexSubImage3D(3G)glDrawPixels(3G)glNewList(3G)glPixelMap(3G)glPixelStore(3G)glPixelZoom(3G)glReadPixels(3G)glTexImage1D(3G)glTexImage2D(3G)glTexImage3D(3G)glTexSubImage1D(3G)glTexSubImage2D(3G)glTexSubImage3D(3G)
and that's the whole page bestie, you ate that π«Ά the footer says GLPIXELTRANSFER(3G) so like, that's the name and the section, periodt π β¨
π¦ where this page comes from
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms