gl.PixelStore(pname, param)
gl.PixelStore() sets pixel storage modes that affect the operation of subsequent gl.DrawPixels() and
gl.ReadPixels() as well as the unpacking of polygon stipple patterns (See gl.PolygonStipple for details.),
bitmaps (See gl.Bitmap for details.), texture patterns (See gl.TexImage for details.).
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_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
#GL_PACK_ROW_LENGTH#GL_PACK_ROW_LENGTH defines the number of pixels in a row. If the first pixel of a row is placed at location
p in memory, then the location of the first pixel of the next row is obtained by skipping a certain number of components or
indices. See an OpenGL reference manual for details.
#GL_PACK_SKIP_PIXELS#GL_PACK_SKIP_PIXELS to i is equivalent to
incrementing the pointer by in components or indices, where n is the number of components or indices in each pixel.
#GL_PACK_SKIP_ROWS#GL_PACK_SKIP_ROWS to j is equivalent to
incrementing the pointer by jm components or indices, where m is the number of components or indices per row, as just computed
in the #GL_PACK_ROW_LENGTH section.
#GL_PACK_ALIGNMENTThe other six of the twelve storage parameters affect how pixel data is read from client memory. These values are then significant for gl.DrawPixels(), gl.TexImage(), and furthermore also for gl.TexImage1D(), gl.TexImage2D(), gl.TexSubImage(), gl.TexSubImage1D(), gl.TexSubImage2D(), gl.Bitmap(), and gl.PolygonStipple(). They are as follows:
#GL_UNPACK_SWAP_BYTES#GL_UNPACK_SWAP_BYTES
is true. #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 #GL_RGB format pixel are always stored with red first, green second,
and blue third, regardless of the value of #GL_UNPACK_SWAP_BYTES.
#GL_UNPACK_LSB_FIRST
#GL_UNPACK_ROW_LENGTH#GL_UNPACK_ROW_LENGTH defines the number of pixels in a row. If the first pixel of a row is placed at location
p in memory, then the location of the first pixel of the next row is obtained by skipping a certain number of components or
indices. See an OpenGL reference manual for details.
#GL_UNPACK_SKIP_PIXELS#GL_UNPACK_SKIP_PIXELS to i is equivalent to incrementing the pointer by in components or indices, where n is the number of
components or indices in each pixel.
#GL_UNPACK_SKIP_ROWS#GL_UNPACK_SKIP_ROWS to j is equivalent to incrementing the pointer by jk components or indices, where k is the number of
components or indices per row, as just computed in the #GL_UNPACK_ROW_LENGTH section.
#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 gl.PixelStore().
pname | Type | Default | 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,oo) #GL_PACK_SKIP_ROWS | integer | 0 | [0,oo) #GL_PACK_SKIP_PIXELS | integer | 0 | [0,oo) #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,oo) #GL_UNPACK_SKIP_ROWS | integer | 0 | [0,oo) #GL_UNPACK_SKIP_PIXELS| integer | 0 | [0,oo) #GL_UNPACK_ALIGNMENT | integer | 4 | 1, 2, 4, or 8 |
The pixel storage modes in effect when gl.DrawPixels(), gl.ReadPixels(), or gl.TexImage(), gl.TexImage1D(), or gl.TexImage2D(), or gl.TexSubImage(), gl.TexSubImage1D(), or also GL's gl.TexSubImage2D(), or gl.Bitmap(), or gl.PolygonStipple() is placed in a display list control the interpretation of memory data. The pixel storage modes in effect when a display list is executed are not significant.
Pixel storage modes are client state and must be pushed and restored using gl.PushClientAttrib() and gl.PopClientAttrib().
Please consult an OpenGL reference manual for more information.
pname is set to#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.
#GL_INVALID_OPERATION is generated if gl.PixelStore() is executed between the execution of gl.Begin() and the corresponding execution of gl.End().
#GL_PACK_SWAP_BYTES
gl.Get() with argument #GL_PACK_LSB_FIRST
gl.Get() with argument #GL_PACK_ROW_LENGTH
gl.Get() with argument #GL_PACK_SKIP_ROWS
gl.Get() with argument #GL_PACK_SKIP_PIXELS
gl.Get() with argument #GL_PACK_ALIGNMENT
gl.Get() with argument #GL_UNPACK_SWAP_BYTES
gl.Get() with argument #GL_UNPACK_LSB_FIRST
gl.Get() with argument #GL_UNPACK_ROW_LENGTH
gl.Get() with argument #GL_UNPACK_SKIP_ROWS
gl.Get() with argument #GL_UNPACK_SKIP_PIXELS
gl.Get() with argument #GL_UNPACK_ALIGNMENT