Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

vile

loading bmp from & writing bmp to .dat file

This topic is 6170 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need help! I need to know how to load a bitmap(or tga)(nehe style), if (TextureImage[0]=LoadBMP("Data/NeHe.bmp")) { Status=TRUE; glGenTextures(1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]>sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } and then save it into a class. I will then write that class to a file("texture.dat" or something). And then I want to be able to read the texture or bmp from the file and thereby not having to have a folder full of bmp´s in my gamedir. Thanx! Edited by - vile on November 24, 2001 3:31:39 AM

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I''m not sure what you want, but if you want to make your own data file, that you load it automatically without any bmp or others functions. Do this:
Make white 256x256 bmp file (24-bit), now look the code wiht hex editor. You will see that the first 36 (or 35 I don''t remeber) are really odd numbers, and after that there will be values FFFFFFFF... (256,256,256...) this values tells red, green and blue values (FFFFFF is white and FF0000 is red) you can simple delete the first 36 values (which tell something about bmp format)...
Sorry but I am busy.

Share this post


Link to post
Share on other sites
Thanx for the reply, but I didn´t understand what you told me to do.

I just want a way to use textures in my program, without having to use a folder full of images so that the user can change these images.

Share this post


Link to post
Share on other sites
I just did a similar thing yesterday for my map format. I just wrote a small dos program that opens a heightmap, and all the textures used, and writes it to a single file.....

all you have to do is have a header(array) of however many bytes you want, saying how big each texture is, and mabe which one is which, then you just write that data for each texture one after another.

Then when you need to load the textures, you read in the header, then read in the number of bytes for teh first texture, then read in the number of bytes for teh second texture, and so on...

Hope you understand what I mean =)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!