Game Development Reference
In-Depth Information
topic will be sufficient. Having got the bitmap into memory it will be stored
so that the first pixel in memory is actually the first pixel of the last
rasterline; all the data of this last rasterline follow before it moves on to the
next to last rasterline and so on until the top line is read. The upside-down
nature is common to the Windows Bitmap format.
Informing OpenGL how the bitmaps are stored in memory
OpenGL is able to work with many different storage methods. Four-byte
alignment is just one method; 1-, 2- and 8-byte alignments are also
available. Because we are resizing the bitmap to a power of 2 for the width
and height, it is already aligned, so we can set the alignment to 1; now no
additional bytes are expected at the end of a rasterline regardless of the
size of the bitmap. Another setting that you may sometimes use is byte
ordering. This varies between processors. Some processors, notably
Intel, have the lower value byte before the higher value byte. In others, the
opposite is true. Setting up the way that pixels are stored can mean
setting the byte order. The native byte ordering for the computer on which
OpenGL is running is the default setting.
If you wish to extract a section of a bitmap then you will need to set
values for the row length, and the number of pixels and rows to skip. The
values for these three parameters define a small rectangle within the full
Figure 4.5 Parameters necessary for extracting a sub image.
Search Nedrilad ::




Custom Search