table of contents
GLPIXELSTORE(3G) | [FIXME: manual] | GLPIXELSTORE(3G) |
NAME¶
glPixelStore - set pixel storage modes
C SPECIFICATION¶
void glPixelStoref(GLenum pname, GLfloat param);
void glPixelStorei(GLenum pname, GLint param);
PARAMETERS¶
pname
param
DESCRIPTION¶
glPixelStore sets pixel storage modes that affect the operation of subsequent glReadPixels() as well as the unpacking of texture patterns (see glTexImage1D(), glTexImage2D(), glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(), glTexSubImage3D()), glCompressedTexImage1D(), glCompressedTexImage2D(), glCompressedTexImage3D(), glCompressedTexSubImage1D(), glCompressedTexSubImage2D() or glCompressedTexSubImage1D().
pname is a symbolic constant indicating the parameter to be set, and param is the new value. Six of the twelve storage parameters affect how pixel data is returned to client memory. They are as follows:
GL_PACK_SWAP_BYTES
GL_PACK_LSB_FIRST
GL_PACK_ROW_LENGTH
k = n l a s s n l a s >= a s < a
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (GL_PACK_ROW_LENGTH if it is greater than 0, the width argument to the pixel routine otherwise), a is the value of GL_PACK_ALIGNMENT, and s is the size, in bytes, of a single component (if a < s, then it is as if a = s). In the case of 1-bit values, the location of the next row is obtained by skipping
k = 8 a n l 8 a
components or indices.
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
GL_PACK_IMAGE_HEIGHT
k = n l h a s s n l h a s >= a s < a
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (GL_PACK_ROW_LENGTH if it is greater than 0, the width argument to glTexImage3D() otherwise), h is the number of rows in a pixel image (GL_PACK_IMAGE_HEIGHT if it is greater than 0, the height argument to the glTexImage3D() routine otherwise), a is the value of GL_PACK_ALIGNMENT, and s is the size, in bytes, of a single component (if a < s, then it is as if a = s).
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
GL_PACK_SKIP_PIXELS, GL_PACK_SKIP_ROWS, and GL_PACK_SKIP_IMAGES
GL_PACK_ALIGNMENT
The other six of the twelve storage parameters affect how pixel data is read from client memory. These values are significant for glTexImage1D(), glTexImage2D(), glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(), and glTexSubImage3D()
They are as follows:
GL_UNPACK_SWAP_BYTES
GL_UNPACK_LSB_FIRST
GL_UNPACK_ROW_LENGTH
k = n l a s s n l a s >= a s < a
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (GL_UNPACK_ROW_LENGTH if it is greater than 0, the width argument to the pixel routine otherwise), a is the value of GL_UNPACK_ALIGNMENT, and s is the size, in bytes, of a single component (if a < s, then it is as if a = s). In the case of 1-bit values, the location of the next row is obtained by skipping
k = 8 a n l 8 a
components or indices.
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
GL_UNPACK_IMAGE_HEIGHT
k = n l h a s s n l h a s >= a s < a
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (GL_UNPACK_ROW_LENGTH if it is greater than 0, the width argument to glTexImage3D() otherwise), h is the number of rows in an image (GL_UNPACK_IMAGE_HEIGHT if it is greater than 0, the height argument to glTexImage3D() otherwise), a is the value of GL_UNPACK_ALIGNMENT, and s is the size, in bytes, of a single component (if a < s, then it is as if a = s).
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
GL_UNPACK_SKIP_PIXELS and GL_UNPACK_SKIP_ROWS
GL_UNPACK_ALIGNMENT
The following table gives the type, initial value, and range of valid values for each storage parameter that can be set with glPixelStore.
pname | Type | Initial Value | Valid Range |
GL_PACK_SWAP_BYTES | boolean | false | true or false |
GL_PACK_LSB_FIRST | boolean | false | true or false |
GL_PACK_ROW_LENGTH | integer | 0 | 0 ∞ |
GL_PACK_IMAGE_HEIGHT | integer | 0 | 0 ∞ |
GL_PACK_SKIP_ROWS | integer | 0 | 0 ∞ |
GL_PACK_SKIP_PIXELS | integer | 0 | 0 ∞ |
GL_PACK_SKIP_IMAGES | integer | 0 | 0 ∞ |
GL_PACK_ALIGNMENT | integer | 4 | 1, 2, 4, or 8 |
GL_UNPACK_SWAP_BYTES | boolean | false | true or false |
GL_UNPACK_LSB_FIRST | boolean | false | true or false |
GL_UNPACK_ROW_LENGTH | integer | 0 | 0 ∞ |
GL_UNPACK_IMAGE_HEIGHT | integer | 0 | 0 ∞ |
GL_UNPACK_SKIP_ROWS | integer | 0 | 0 ∞ |
GL_UNPACK_SKIP_PIXELS | integer | 0 | 0 ∞ |
GL_UNPACK_SKIP_IMAGES | integer | 0 | 0 ∞ |
GL_UNPACK_ALIGNMENT | integer | 4 | 1, 2, 4, or 8 |
glPixelStoref can be used to set any pixel store parameter. If the parameter type is boolean, then if param is 0, the parameter is false; otherwise it is set to true. If pname is a integer type parameter, param is rounded to the nearest integer.
Likewise, glPixelStorei can also be used to set any of the pixel store parameters. Boolean parameters are set to false if param is 0 and true otherwise.
ERRORS¶
GL_INVALID_ENUM is generated if pname is not an accepted value.
GL_INVALID_VALUE is generated if a negative row length, pixel skip, or row skip value is specified, or if alignment is specified as other than 1, 2, 4, or 8.
ASSOCIATED GETS¶
glGet() with argument GL_PACK_SWAP_BYTES
glGet() with argument GL_PACK_LSB_FIRST
glGet() with argument GL_PACK_ROW_LENGTH
glGet() with argument GL_PACK_IMAGE_HEIGHT
glGet() with argument GL_PACK_SKIP_ROWS
glGet() with argument GL_PACK_SKIP_PIXELS
glGet() with argument GL_PACK_SKIP_IMAGES
glGet() with argument GL_PACK_ALIGNMENT
glGet() with argument GL_UNPACK_SWAP_BYTES
glGet() with argument GL_UNPACK_LSB_FIRST
glGet() with argument GL_UNPACK_ROW_LENGTH
glGet() with argument GL_UNPACK_IMAGE_HEIGHT
glGet() with argument GL_UNPACK_SKIP_ROWS
glGet() with argument GL_UNPACK_SKIP_PIXELS
glGet() with argument GL_UNPACK_SKIP_IMAGES
glGet() with argument GL_UNPACK_ALIGNMENT
VERSION SUPPORT¶
OpenGL Version | ||||||||||||
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glPixelStoref | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
glPixelStorei | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
SEE ALSO¶
glReadPixels(), glTexImage1D(), glTexImage2D(), glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(), glTexSubImage3D(), glCompressedTexImage1D(), glCompressedTexImage2D(), glCompressedTexImage3D(), glCompressedTexSubImage1D(), glCompressedTexSubImage2D(), glCompressedTexSubImage1D().
COPYRIGHT¶
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¶
Copyright © 1991-2006 Silicon Graphics, Inc.
Copyright © 2010-2014 Khronos Group
04/12/2021 | [FIXME: source] |