Archived

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

quatre53

Extreme difficulty Loading my first Bitmap

Recommended Posts

quatre53    122
I''ve spent the last week trying about 10-20 different ways of loading bmps into Direct X, and I just cannot get it to work. I cannot even get the source code that loads bitmaps in Andre Lamothes'' ''WGPForDummies'' and ''Game Programming Gurus'' books to work. Every time the function Load_Bitmap_File is called, it ends up closing the program. I''m using VC++6. I don''t know if theres a problem with my computer, my compiler, or just me. I''ve literally attempted loading bitmaps with every kind of process I could find on the web, but none seem to work at all. If anyone could help me out, or even help me to find out if it is just my compiler or something, please let me know. (I''ve been mad at programming problems before, but this one has just about pushed me off the deep-end) Thanks

Share this post


Link to post
Share on other sites
ktuluorion    393
quote:
Original post by quatre53
I''ve spent the last week trying about 10-20 different ways of loading bmps into Direct X, and I just cannot get it to work. I cannot even get the source code that loads bitmaps in Andre Lamothes'' ''WGPForDummies'' and ''Game Programming Gurus'' books to work. Every time the function Load_Bitmap_File is called, it ends up closing the program.

I''m using VC++6. I don''t know if theres a problem with my computer, my compiler, or just me. I''ve literally attempted loading bitmaps with every kind of process I could find on the web, but none seem to work at all.

If anyone could help me out, or even help me to find out if it is just my compiler or something, please let me know.
(I''ve been mad at programming problems before, but this one has just about pushed me off the deep-end)
Thanks


Just look at the DirectX samples code. Use the DDUTIL library. It''s easy, just research it.

And don''t use Lamothe''s thing. Do it the way Microsoft does it.

-Mike

Share this post


Link to post
Share on other sites
fimpen    122
Oh dear, I had the same problem myself.
The key to this problem (if you still want to write your own API) is that some image processing programs (photoshop for example) don´t write anything to the .biSizeImage member of the BITMAPINFOHEADER. Hence, what you need to add to your code is probably a simple:

// infoheader is a BITMAPINFOHEADER struct loaded with your
// bitmap data

if (!(infoheader.biSizeImage))
infoheader.biSizeImage =
infoheader.biWidth *
infoheader.biHeight;

If you encounter similar problems in the future, remember always to chech the values of all variables, either using the degugger or printing them out to the screen.

be well / the fimp

Share this post


Link to post
Share on other sites