1991-2006 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. One value affects the packing of pixel data into memory: `GL_PACK_ALIGNMENT`. The other affects the unpacking of pixel data from memory: `GL_UNPACK_ALIGNMENT`.

`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 texture patterns (see

glTexImage2D

and

glTexSubImage2D

).

`pname` is a symbolic constant indicating the parameter to be set, and `param` is the new value. One storage parameter affects how pixel data is returned to client memory:

`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 storage parameter affects how pixel data is read from client memory:

`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 `glPixelStorei`.

`pname` | Type | Initial Value | Valid Range
`GL_PACK_ALIGNMENT` | integer | 4 | 1, 2, 4, or 8
`GL_UNPACK_ALIGNMENT` | integer | 4 | 1, 2, 4, or 8

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 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

,

glTexImage2D

,

glTexSubImage2D

## Copyright

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