2003-2004 Silicon Graphics, Inc.
glPixelStorei 3G
glPixelStorei set pixel storage modes

## C Specification

void `glPixelStorei` GLenum pname GLint param

## Parameters

pname

  Specifies the symbolic name of the parameter to be set. `GL_PACK_ALIGNMENT` affects the packing of pixel data into memory. `GL_UNPACK_ALIGNMENT` affects the unpacking of pixel data from memory.

param

  Specifies the value that pname is set to.

## Description

`glPixelStorei` sets pixel storage modes that affect the operation of subsequent glReadPixels as well as the unpacking of glTexImage2D, and glTexSubImage2D.

pname is a symbolic constant indicating the parameter to be set, and param is the new value. The following storage parameter affects how pixel data is returned to client memory. This value is significant for glReadPixels:

`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 initial value is 4.

The following storage parameter affects how pixel data is read from client memory. This value is significant for glTexImage2D and glTexSubImage2D:

`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 initial value is 4.

## Notes

Pixel storage modes are client states.

glCompressedTexImage2D and glCompressedTexSubImage2D are not affected by `glPixelStorei`.

## Errors

`GL_INVALID_ENUM` is generated if pname is not an accepted value.

`GL_INVALID_VALUE` is generated if alignment is specified as other than 1, 2, 4, or 8.

## Associated Gets

glGet with argument `GL_PACK_ALIGNMENT` or `GL_UNPACK_ALIGNMENT`

## See Also

glReadPixels, glCompressedTexImage2D, glCompressedTexSubImage2D, glTexImage2D, glTexSubImage2D

## Copyright

Copyright 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.