Archived

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

Drakonite

too much caffeine to load!!

Recommended Posts

Arg... Ever have one of those days? You know the kind, where you haven't slept since last week, and have had so much caffeine you can't even do the simplist things, especially for the project that is due first thing in the morning that you haven't barely started? For some reason, no matter how hard I try I can't figure out how to load a bitmap into a directx surface. I know this is about as basic as it gets, but can somebody help me out please? I swear my compilier is going to stop giving me real errors and instead start saying "error: Nah, I don't want to" BTW, i'm using VC++6. Edited by - drakonite on January 15, 2002 9:59:13 PM

Share this post


Link to post
Share on other sites
I dont know for sure, but I''m thinking you can load the bitmap via you favorite way (LoadImage() or use the FreeImage library).

Then you can either walk the bitmap data yourself, populating the surface manually (using surface->lock/unlock). This would be slow, but I''m sure it''ll work.

Or you could use GetDIBits(), which looks like it''ll copy the bitmap data into a buffer (aka the surface?) in the format that you specify.

I haven''t done this, so bear with me if it doesn''t work .. but no one else replied to this, so I thought I''d take a stab.


-Brannon

Share this post


Link to post
Share on other sites
A file called DDUtil.cpp/.h has utility programs that can take care of that for you. You can use DDLoadBitmap, which loads the bitmap, creates the surface and returns the surface from the function call.

If you have an existing surface, you can us DDReLoadBitmap.

You can just search the header file for these two functions to find out what the parameter list is.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home

Share this post


Link to post
Share on other sites
LoadImage and other utilities use the same Lock/Unlock functions to load image data onto the surface.

Since talking about surfaces I suppose you''re using DDraw. You may also try using GetDC and Blt() GDI function to blit the image data from some bitmap onto your surface.

Share this post


Link to post
Share on other sites