Jump to content
  • Advertisement


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


DirectX & Bitmap Loading

This topic is 6277 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

This is weird I have NEVER had trouble loading bitmaps under DirectX until today? Ive been looking and playing with this code for a little over an hour. Maybe there''s something im just not seeing. LPDIRECTDRAW lpdd; LPDIRECTDRAWSURFACE lpddsprimary; struct INFO { LPDIRECTDRAWPALETTE lpddpal; LPDIRECTDRAWSURFACE surface; RECT rect; } INFO Array[10]; Array[1].lpddpal = DDLoadPalette(lpdd, "Mech.BMP"); lpddsprimary->SetPalette(Array[1].lpddpal); Array[1].surface = DDLoadBitmap(lpdd, "Mech.BMP", 51, 51); dest.left = 1; dest.top = 1; dest.right = 51; dest.bottom = 51; Array[1].rect.left = 1; Array[1].rect.top = 1; Array[1].rect.right = 51; Array[1].rect.bottom = 51; // blt the image loaded from Mech.bmp onto the backbuffer lpddsback->Blt(&dest, Array[1].surface, &Array[1].rect, DDBLT_KEYSRC | DDBLT_WAIT, NULL); // flip the primary with the backbuffer while(lpddsprimary->Flip(NULL, DDFLIP_WAIT)!=DD_OK); // I used the standard naming conventions to make the code easier to read. PEACE, Rob

Share this post

Link to post
Share on other sites
Do you check the surface returned by DDLoadBitmap? Maybe its returning NULL for some reason.

Also, are you using the correct surface and DDLoadBitmap versions? If you are using DDraw7 make sure all your LPDIRECTDRAWSURFACE''s are ''LPDIRECTDRAWSURFACE7'' and that the code in DDLoadBitmap is using ''LPDIRECTDRAWSURFACE7''.

If all else fails, use 16Bit instead of the crappy 8Bit palette mode, almost all PC''s out there perform good with 16Bit color modes and you have access to 65536 colors.

My game pushes DDraw to the limits so download the DDraw version of my game if you would like to test 16Bit color on your PC.

Demo Download: www.angelfire.com/realm/zeroone

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!