Is there a way to place a bmp file as a background image for an opengl application? Any help would be appreciated. Thanks.
You need to set a orthographic projection (glOrtho or gluOrto2D) the load a bitmap file in a texture (this is the tricky part)… Set vertex coordinates to match those of your projection, load identity matrix in model view and display a quad that cover the screen at the fartest possible position in z.
Thats correct so far, but instead of drawing far away you could also disable depth buffering and draw it before anything else. That spares you some time needed to fill the backbuffer.
[This message has been edited by Kilam Malik (edited 12-08-2000).]
I’ve written a small program to demonstrate how to do that. It uses glut. If you want, I can send you the source code.
Note that if you want to use a textured quad for your background, you’ll need to specify an image with power of 2 dimensions (no OGL implementation supports non power of 2 dimensions yet). If you want to use any size for the background image, you can use glDrawPixels to draw the background, but that is much slower because the image is still in your RAM and not in the texture memory of your HW accelerator. If you don’t have a HW accelerator though, I don’t think that there will be too much difference between the use of a textured quad or glDrawPixels.