How to add an image/C++ OpenGL?

Hi,

I have been trying to look online for this and, so far, I haven't found anything useful. I would like to add a .bmp image to an OpenGL window. The lines here (GL_LINES), are irrelevant, something else to put with the image.

I’m fairly new to C++. I would appreciate it if anybody could help with anything.
1
2
3
4
5
6
7
8
9
10
11
12
void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT); // clear the screen
    glBegin(GL_LINE_LOOP);
    glVertex2i(318,0);
    glVertex2i(318,250);
    glVertex2i(322,250);
    glVertex2i(322,0);
    glEnd();
    //I want to add "Tiger (left)_.bmp" here
    glFlush(); // send all output to display
}

Thanks.
Try http://www.nullterminator.net/gltexture.html .
They explain it with .raw files, but it isn't hard to change that. To load .bmp you can either write your own function ( google gave me http://www.gamedev.net/reference/articles/article1966.asp ) or find a library which does that for you ( google gave me http://openil.sourceforge.net/ ). The rest should work fine.
Hope this helps
Well, it's a bit complicated. But thanks!
I wrote simple BMP and TGA readers for use with OpenGL a while ago.
They aren't large, but they exceed the post limit here. If you want them, PM me and let me know where I can email them to you.
Topic archived. No new replies allowed.