Advertisement

Loading Textures

Started by January 27, 2003 11:33 AM
5 comments, last by NewGuy2003 22 years, 1 month ago
Hi, I am having problems loading textures. I cannot use the glaux.lib file, I dont know why, I just cant. I have written a function (actually modified someone elses) to load a bitmap file and then setup the texture. I am using the texture from tutorial 6 on this site, I have written a basic wrapper class for the window creation stuff, the rendering, resizing and intialization function are virtual functions, you can see that code by opening the texture.cpp file in the zip file. The bitmap is in the afxLoadBitmap.cpp file. Somebody please help me, I am having been going at this for a couple of days now. Here is the link to the zip file Texture Source Code thanks.
New User
GLaux.dll is probably missing. I am fairly new, and I just had this problem. Most computers don''t use it because it''s outdated. If you need it, run a google search for "download glaux.dll". Be sure to use the "s. You can download it at the bottom of the second of two entries. You should avoid using bitmaps and GLaux, though. Instead, try TGA files and NeHe''s lesson 22 or 24 (nehe.gamedev.net). To edit TGAs, there is the GIMP for Lin or Win, or a free convertor program. Sorry I don''t have the links.
Advertisement
Hi,

Thanks for that. I discovered the problem, and it was the image I was using. I download the source code for the book OpenGL Game Programming and it has a function to load a bitmap and it works almost exactly the same as the one I wrote, and it also has problems with the image I was having problems with. I am guessing that the format of the file must be different (how different versions of .bmp files are there?). When I read the windows documentation I see that there is one format for DIBs and another for BMPs, however the way the code I am using loads a bitmap dosent fit with the file format, but it still works on some files. I know that there is compression that can be used for bmps but I thought that this compression was never used? I guess it must be.

The image I was having problems with was the nehe.bmp from tutorial 6 at NeHe I know that this file loads and works when loading the bitmap using a function from glaux but I guess it must check for the correct format.

Does anyone know if this is right? I will test it, but this will probably take a while as I have to work out the different compression stuff.

thanks.
New User
It is important to note that TGAs created with The GIMP, while being perfectly valid according to the TGA format, contain extended headers that NeHe''s code cannot cope with.

If you want to extend NeHe''s code to support it, try the "File Formats" link in my sig.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Asking Questions | Go FAQ yourself ]

U can try to open the problem bmp file in paintbrush, and save it into another file and load the new file in your code.
Hi again,

Yep, when I opened it in paintbrush and created a new file with the same image, it worked!

In the problem bmp file the file header had a size that was different to the working bmp file, and in the problem file info header the biSizeImage was 0, and in the working bmp file, biSizeImage was equal to the pixel data size.

Ignoring the difference in size in the file header, both files can now be loaded by calculating the pixel data length using the width * height * 3 from the info header.

I guess the program that created the problem bmp file saves into a different bmp file format, but I cannot understand why the bfSize member of the file header was different, because both bmp file images are identical. ?????

Anyway, I got it working, and thats all that counts.

thanks.

PS. Does anyone know if bmp files still support compression or is this obselete?
New User
Advertisement
thought Glaux wasnt supported any more :\
Free Your mind Free your Feeling~~~Working on~~~Nothing

This topic is closed to new replies.

Advertisement