Drawing A Bitmap From File

Is there an easy way to be able to draw a bitmap from file at specific coordinates on the screen? Thanks.

Yes, with drawpixels and rasterpos

I’ve seen that, but I was wondering how to use it…

You would properly also like to use glOrtho2D to set the model-view matrix for 2D rendering.
And then use glDrawPixels, like below (i.e pixels is a STL vector of your data)

glDrawPixels(512,512,GL_RGB,GL_UNSIGNED_BYTE, &pixels[0]);

well, yes, but what I am asking is how do I do it when I have a bitmap file

You first have to read the file and convert it to a data container in system memory before you can download it to the GPU.
Non-compressed file formats (bmp,ppm,…) usually take only a few lines of code to do this.
If you’re reading compressed textures (jpg,…) you’ll need an image library such as DevIL,imageMagick or whatever image library you prefer (these also work for non compressed image formats).

How to laod them?

Look at the end of this thread:

http://www.opengl.org/discussion_boards/…3307#Post233307

The data from GetBits() is what yopu have to put in glDrawPixels.

Hey
Have a look at
http://www.cs.ucdavis.edu/~amenta/s06/proj0/portrait.html

It might be of some help