thanks for the reply. i think i found a way to load bitmaps as textures, but the code i found, applied the texture to a 3d object, and when i removed the object, i couldnt get it to display. this is the code i found to load a bitmap:
///////////////////////////////////////
unsigned char *LoadBitmapFile(char *file, BITMAPINFOHEADER *bitmapInfoHeader)
{
// Bitmaps are made up of 3 parts, the file header, info header, and
// the image. Once we load in the file and info headers we can then
// load the image into our unsigned char variable called bitmapData.
FILE *pFile; // Need this to open a file.
BITMAPFILEHEADER header; // This will hold the bitmap header information.
unsigned char *textureData; // This will hold the bitmap image itself.
// This will be used to swap the image colors from BGR to RGB.
unsigned char textureColors;
pFile = fopen(file, "rb"); // Open the file.
if(pFile == NULL) return NULL;// Check and make sure there are no errors.
// Read in the bitmap header info into the BITMAPFILEHEADER variable.
fread(&header, sizeof(BITMAPFILEHEADER), 1, pFile);
// Make sure this is a real bitmap by checking the ID.
if(header.bfType != BITMAP_ID)
{
fclose(pFile);
return NULL;
}
// Read in the second header info into the BITMAPINFOHEADER variable.
fread(bitmapInfoHeader, sizeof(BITMAPINFOHEADER), 1, pFile);
// Place the pointer in front of where the image data starts.
fseek(pFile, header.bfOffBits, SEEK_SET);
// Dynamically create enough memory for the image.
textureData = (unsigned char*)malloc(bitmapInfoHeader->biSizeImage);
// Error checking. Make sure the memory was allocated.
if(!textureData)
{
free(textureData);
fclose(pFile);
return NULL;
}
// Read in the image.
fread(textureData, 1, bitmapInfoHeader->biSizeImage, pFile);
// Error checking. Make sure an image was loaded.
if(textureData == NULL)
{
fclose(pFile);
return NULL;
}
// Bitmaps are saved in BGR format so we will make the image RGB by...
for(unsigned index = 0; index < bitmapInfoHeader->biSizeImage; index+=3)
{
textureColors = textureData[index];
textureData[index] = textureData[index + 2];
textureData[index + 2] = textureColors;
}
fclose(pFile); // We are done with the file so close it.
return textureData; // Send the image to the function that called this.
}
////////////////////////////////////
i then tried displaying the bitmap using (the code i found used glGenTexture or something and it didnt show anything):
glBitmap(192, 128, 0, 0, 0, 0, bitmapData);
it shows a black and white image that is unrecognizable as originating from the input image.
what am i doing wrong?
thanks again