OpenGL Super Bible! Page 413 A Bitmap File (Cheap web hosting)
OpenGL Super Bible! Page 413 A Bitmap File Viewer Now that we ve covered all the bitmap-related functions that are available, let s write a Windows .BMP file-viewing program using OpenGL. Our goals for this program are fairly straightforward: Load any Windows .BMP file Scale the image to the current window size Provide simple controls to change the image brightness and gamma correction Show a magnified view of the image underneath the mouse pointer Save the displayed image to disk Print the displayed image The final code for this program can be found in CH11OGLVIEW.C. About Windows Bitmap Files Before we write the code, let s review the ubiquitous Windows bitmap format. Despite their limitations, Windows .BMP files are probably the most common and widely supported files used by PCs capable of from 2 to 16.7 million colors. With only a few exceptions, .BMP files do not utilize data compression schemes, so it s easy to read and use these files in your OpenGL programs. A .BMP file is organized into three or four sections, depending on the type of colors used (see Figure 11-3). All .BMP files start with a BITMAPFILEHEADER structure containing an identification string ( BM ) the total size of the file, and an offset to the actual image data. Here is that structure: typedef struct { WORD bfType; /* BM */ DWORD bfSize; /* Size of file in bytes */ WORD bfReserved1; /* Reserved, always 0 */ WORD bfReserved2; /* Reserved, always 0 */ DWORD bfOffBits; /* Offset to image in bytes */ } BITMAPFILEHEADER; Figure 11-3 Organization of a .BMP file
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.