I've read over NeHe's tut on bitmap textures, and I still really don't get how most of the stuff works. Can anyone link me to an idiot's guide to bitmap textures?
I've read over NeHe's tut on bitmap textures, and I still really don't get how most of the stuff works. Can anyone link me to an idiot's guide to bitmap textures?
What don't you understand, the loading of the bitmaps or the actual texturing?
Loading 'em.Originally posted by Eibro
What don't you understand, the loading of the bitmaps or the actual texturing?
is there a specific part of loading them you are unclear on? Ask us a few questions im sure we can help.
Mostly like how to load more than one texture and make it work. I can't make it work for crap if I try to load two textures.Originally posted by RoD
is there a specific part of loading them you are unclear on? Ask us a few questions im sure we can help.
I'm also not really familiar with the how the functions n' such you use to load bitmap files work.
Here ya go.
http://www.codeguru.com/bitmap/BitmapLoad.html
It explains the structure of the BMP File and then gives you code for loading it.
Here is my recommendation to you. Write a library for yourself to load and save BMP's. Then later when you get more and more comftorable with bitmaps you can extend it to support a lot of different manipulations to bitmaps. It will be a great exercise and you will be able to use it in a lot of different applications. Some features could be:
* Handling RLE8 Compression
* Bi-Linear Filtering
* Scaling
* Rotating
* Inverting
* Alpha Blending
* Dithering
etc.
the glaux library provides a method for loading a bitmap. I'm not sure how NeHe's does it, however this method has always worked for me. The auxDIBImageLoad(char*) function is what does the actual work of loading the bitmap, the rest just wraps around it to pass to OpenGL. I think I might've written this off of OpenGL Game Programming's code, or somethng...i don't remember.
Anyway the aux library tends to have bugs, but this function has worked fine. It works for me because I'm lazy, and on top of being lazy I have other more interesting things to be doing...although you can't manipulate the bitmap's data as wizard suggested.
Code:UINT LoadBMP(char * FileName) { UINT texture = 0; if(!FileName) return NULL; AUX_RGBImageRec *pImage; FILE *pFile = fopen(FileName, "rb"); if(!pFile) return NULL; pImage = auxDIBImageLoad(FileName); if(!pImage) { return NULL; } texture = GenerateInternalTexture(pImage->data, 3, pImage->sizeX, pImage->sizeY, GL_RGB); if (pImage) { if (pImage->data) { free(pImage->data); } free(pImage); } return texture; }
You might want to match that call to fopen with a call to fcloseOriginally posted by Silvercord
the glaux library provides a method for loading a bitmap. I'm not sure how NeHe's does it, however this method has always worked for me. The auxDIBImageLoad(char*) function is what does the actual work of loading the bitmap, the rest just wraps around it to pass to OpenGL. I think I might've written this off of OpenGL Game Programming's code, or somethng...i don't remember.
Anyway the aux library tends to have bugs, but this function has worked fine. It works for me because I'm lazy, and on top of being lazy I have other more interesting things to be doing...although you can't manipulate the bitmap's data as wizard suggested.
Code:UINT LoadBMP(char * FileName) { UINT texture = 0; if(!FileName) return NULL; AUX_RGBImageRec *pImage; FILE *pFile = fopen(FileName, "rb"); if(!pFile) return NULL; pImage = auxDIBImageLoad(FileName); if(!pImage) { return NULL; } texture = GenerateInternalTexture(pImage->data, 3, pImage->sizeX, pImage->sizeY, GL_RGB); if (pImage) { if (pImage->data) { free(pImage->data); } free(pImage); } return texture; }
naw
fclose is for losers
That's why I suggested it to you.Originally posted by Silvercord
naw
fclose is for losers