DirectX & Bitmap Loading

Started by
1 comment, last by NookieMonster 22 years, 10 months ago
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
Advertisement
Anyone gonna help me?
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

  Downloads:  ZeroOne Realm

This topic is closed to new replies.

Advertisement