I wrote SDL_LoadBMP, of course, I meant to say SDL_image
Peter> ----- Original Message -----
From: @Peter_Venis (Peter Venis)
Sent: Monday, August 13, 2001 10:49 AM
Subject: Re: [SDL] OpenGL Textures
You could use SDL_LoadBMP to load the texture. And for many that is a
sufficient way, but it has one great dissadvantadge. You have to store the
bitmap in a standard format (like BMP) and so everybody can view the
in your directory prior to playing your game or application. In many
you don’t want that.
One easy way to make your own image file format is to make a small
application that loads the image using a image library like SDL_LoadBMP or
OpenIL(can load almost any image format) and then storing the pixel
information using the following C++ functions:
fout = fopen(“my_format.bmf”, “wb”);
fwrite(pixel_data, 1, 256256, fout);
You don’t need a file header or other shit since no one else is supposed
read the file. After this you write the code in your main application that
loads the file my_format.bmf. You can use this simple code:
fin = fopen(“my_format.bmf”, “rb”);
fread( pixel_data, 1, 256*256, fin );
You can also store numerous textures into one big file. After this you use
the OpenGL functions to convert the array of pixel-data to an OpenGL
Hope this helps,
----- Original Message -----
From: Adam Gates
Sent: Monday, August 13, 2001 6:10 AM
Subject: [SDL] OpenGL Textures
What is the best way to load image files into OpenGL textures?
Should I use SDL_image to load it and then convert to an OpenGL texture?
(Anybody have code for that?)
Or use some other library?