Game Development Reference
In-Depth Information
Table 4.3 glPixelStore() parameters
Parameter name
Default value
Range
GL_UNPACK_SWAP_BYTES
FALSE
TRUE/FALSE
GL_UNPACK_LSB_FIRST
FALSE
TRUE/FALSE
GL_UNPACK_ROW_LENGTH
0
Any non-negative integer
GL_UNPACK_SKIP_ROWS
0
Any non-negative integer
GL_UNPACK_SKIP_PIXELS
0
Any non-negative integer
GL_UNPACK_ALIGNMENT
4
1, 2, 4, 8
bitmap. Figure 4.5 shows how these values define the rectangle within the
bitmap.
Table 4.3 lists a full set of possible values that can be used when setting
up the pixel storage parameters for unpacking a bitmap image into
OpenGL texture memory.
Creating a texture ID number
To use textures efficiently in OpenGL you need to use texture objects.
Some older cards may not be able to work with texture objects, but any
recent card handles them very efficiently, storing the pixel data on the
card rather than in main memory. Before OpenGL can handle these data
it needs to know which texture object you are dealing with. You need to
get a number for this object, then to use this texture object in future you
inform OpenGL that the texture with this ID is the texture object to be used
in subsequent texture operations. You use
void glGenTextures ( Glsizei n , Gluint *texIDs )
to generate ' n ' ID numbers. You must store these values because you will
need them when deleting the texture objects with the IDs you have just
generated.
Binding the texture ID and setting up wrapping and
filtering parameters
In order to use the texture objects they need to be bound using
glBindTexture(). The first call to glBindTexture() creates the texture object
 
Search Nedrilad ::




Custom Search