Specifies the symbolic name of the parameter to be set. Six values affect the packing of pixel data into memory: GL_PACK_SWAP_BYTES, GL_PACK_LSB_FIRST, GL_PACK_ROW_LENGTH, GL_PACK_IMAGE_HEIGHT, GL_PACK_SKIP_PIXELS, GL_PACK_SKIP_ROWS, GL_PACK_SKIP_IMAGES, and GL_PACK_ALIGNMENT. Six more affect the unpacking of pixel data from memory: GL_UNPACK_SWAP_BYTES, GL_UNPACK_LSB_FIRST, GL_UNPACK_ROW_LENGTH, GL_UNPACK_IMAGE_HEIGHT, GL_UNPACK_SKIP_PIXELS, GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_IMAGES, and GL_UNPACK_ALIGNMENT.
Specifies the value that pname is set to.
Generated using TypeDoc
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).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 If true, byte ordering for multibyte color components, depth components, or stencil indices is reversed. That is, if a four-byte component consists of bytes ๐โ, ๐โ, ๐โ, ๐โ, it is stored in memory as ๐โ, ๐โ, ๐โ, ๐โ if GL_PACK_SWAP_BYTES is true. GL_PACK_SWAP_BYTES has no effect on the memory order of components within a pixel, only on the order of bytes within components or indices. For example, the three components of a GL_RGB format pixel are always stored with red first, green second, and blue third, regardless of the value of GL_PACK_SWAP_BYTES.
GL_PACK_LSB_FIRST If true, bits are ordered within a byte from least significant to most significant; otherwise, the first bit in each byte is the most significant one.
GL_PACK_ROW_LENGTH If greater than 0, GL_PACK_ROW_LENGTH defines the number of pixels in a row. If the first pixel of a row is placed at location ๐ฉ in memory, then the location of the first pixel of the next row is obtained by skipping
ใ คใ ค โงใ คใ ค๐ง๐ฅใ คใ คใ คใ ค๐ฌ >= ๐
๐ = โจ
ใ คใ ค โฉ ๐/๐ฌโ๐ฌ๐ง๐ฅ/๐โใ คใ ค๐ฌ < ๐
components or indices, where ๐ง is the number of components or indices in a pixel, ๐ฅ 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), ๐ is the value of GL_PACK_ALIGNMENT, and ๐ฌ is the size, in bytes, of a single component (if ๐ < ๐ฌ, then it is as if ๐ = ๐ฌ). In the case of 1-bit values, the location of the next row is obtained by skipping
๐ = 8๐โ๐ง๐ฅ/8๐โ
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.
ใ คใ ค โงใ คใ ค๐ง๐ฅ๐กใ คใ คใ คใ ค๐ฌ >= ๐
๐ = โจ
ใ คใ ค โฉ ๐/๐ฌโ๐ฌ๐ง๐ฅ๐ก/๐โใ คใ ค๐ฌ < ๐
components or indices, where ๐ง is the number of components or indices in a pixel, ๐ is the number of pixels in a row ({@link GL_PACK_ROW_LENGTH} if it is greater than 0, the width argument to {@link glTexImage3D} otherwise), ๐ก is the number of rows in a pixel image ({@link GL_PACK_IMAGE_HEIGHT} if it is greater than 0, the height argument to the {@link glTexImage3D} routine otherwise), ๐ is the value of {@link GL_PACK_ALIGNMENT}, and ๐ฌ is the size, in bytes, of a single component (if ๐ < ๐ฌ, then it is as if ๐ = ๐ฌ).
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format {@link GL_RGB}, for example, has three components per pixel: first red, then green, and finally blue.
{@link GL_PACK_SKIP_PIXELS}, {@link GL_PACK_SKIP_ROWS}, and {@link GL_PACK_SKIP_IMAGES} These values are provided as a convenience to the programmer; they provide no functionality that cannot be duplicated simply by incrementing the pointer passed to {@link glReadPixels}. Setting {@link GL_PACK_SKIP_PIXELS} to ๐ข is equivalent to incrementing the pointer by ๐ข๐ง components or indices, where ๐ง is the number of components or indices in each pixel. Setting {@link GL_PACK_SKIP_ROWS} to ๐ฃ is equivalent to incrementing the pointer by ๐ฃ๐ฆ components or indices, where ๐ฆ is the number of components or indices per row, as just computed in the {@link GL_PACK_ROW_LENGTH} section. Setting {@link GL_PACK_SKIP_IMAGES} to ๐ค is equivalent to incrementing the pointer by ๐ค๐ฉ, where ๐ฉ is the number of components or indices per image, as computed in the {@link GL_PACK_IMAGE_HEIGHT} section.
{@link GL_PACK_ALIGNMENT} Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
The other six of the twelve storage parameters affect how pixel data is read from client memory. These values are significant for {@link glTexImage1D}, {@link glTexImage2D}, {@link glTexImage3D}, {@link glTexSubImage1D}, {@link glTexSubImage2D}, and {@link glTexSubImage3D}
They are as follows:
{@link GL_UNPACK_SWAP_BYTES} If true, byte ordering for multibyte color components, depth components, or stencil indices is reversed. That is, if a four-byte component consists of bytes ๐โ, ๐โ, ๐โ, ๐โ, it is stored in memory as ๐โ, ๐โ, ๐โ, ๐โ if {@link GL_UNPACK_SWAP_BYTES} is true. {@link GL_UNPACK_SWAP_BYTES} has no effect on the memory order of components within a pixel, only on the order of bytes within components or indices. For example, the three components of a {@link GL_RGB} format pixel are always stored with red first, green second, and blue third, regardless of the value of {@link GL_UNPACK_SWAP_BYTES}.
{@link GL_UNPACK_LSB_FIRST} If true, bits are ordered within a byte from least significant to most significant; otherwise, the first bit in each byte is the most significant one.
{@link GL_UNPACK_ROW_LENGTH} If greater than 0, {@link GL_UNPACK_ROW_LENGTH} defines the number of pixels in a row. If the first pixel of a row is placed at location ๐ฉ in memory, then the location of the first pixel of the next row is obtained by skipping
ใ คใ ค โงใ คใ ค๐ง๐ฅใ คใ คใ คใ ค๐ฌ >= ๐
๐ = โจ
ใ คใ ค โฉ ๐/๐ฌโ๐ฌ๐ง๐ฅ/๐โใ คใ ค๐ฌ < ๐
components or indices, where ๐ง is the number of components or indices in a pixel, ๐ฅ is the number of pixels in a row ({@link GL_UNPACK_ROW_LENGTH} if it is greater than 0, the width argument to the pixel routine otherwise), ๐ is the value of {@link GL_UNPACK_ALIGNMENT}, and ๐ฌ is the size, in bytes, of a single component (if ๐ < ๐ฌ, then it is as if ๐ = ๐ฌ). In the case of 1-bit values, the location of the next row is obtained by skipping
๐ = 8๐โ๐ง๐ฅ/8๐โ
components or indices.
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format {@link GL_RGB}, for example, has three components per pixel: first red, then green, and finally blue.
ใ คใ ค โงใ คใ ค๐ง๐ฅ๐กใ คใ คใ คใ ค๐ฌ >= ๐
๐ = โจ
ใ คใ ค โฉ ๐/๐ฌโ๐ฌ๐ง๐ฅ๐ก/๐โใ คใ ค๐ฌ < ๐
components or indices, where ๐ง is the number of components or indices in a pixel, ๐ 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), ๐ก is the number of rows in a pixel image (GL_UNPACK_IMAGE_HEIGHT if it is greater than 0, the height argument to the pixel routine otherwise), ๐ is the value of GL_UNPACK_ALIGNMENT, and ๐ฌ is the size, in bytes, of a single component (if ๐ < ๐ฌ, then it is as if ๐ = ๐ฌ).
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 These values are provided as a convenience to the programmer; they provide no functionality that cannot be duplicated by incrementing the pointer passed to glTexImage1D, glTexImage2D, glTexSubImage1D or glTexSubImage2D. Setting GL_UNPACK_SKIP_PIXELS to ๐ข is equivalent to incrementing the pointer by ๐ข๐ง components or indices, where ๐ง is the number of components or indices in each pixel. Setting GL_UNPACK_SKIP_ROWS to ๐ฃ is equivalent to incrementing the pointer by ๐ฃ๐ค components or indices, where ๐ค is the number of components or indices per row, as just computed in the GL_UNPACK_ROW_LENGTH section.
GL_UNPACK_ALIGNMENT Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
The following table gives the type, initial value, and range of valid values for each storage parameter that can be set with
glPixelStore
.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.