Skip to main content
GameDev.net gamedev.net
🔒 Locked

DDraw: Using 8bpp surfaces (for sprites) within 32bpp fullscreen?

Started by WW Jan 4, 2003 at 10:34 PM 4 replies 650+ views
Original Post
WW
WW
Hi, Is it possible with DirectDraw to use surfaces of different pixelformat as the initialized screen mode? I''d like to use different palettized graphics as well as 32bit ones, and display them within a 32 bit mode. This allows me to save alot of video memory (since many small gfx work well with only 256 colors) as well as doing some nice palette animation effects However, when i tried it, i could setup all those surfaces without getting any errors, but whenever i tried to blit the 8bpp ones, my pc simply locked up. I tried 16bpp as well, no luck here too. Is this supposed to work? Or must all surfaces have the same pixel format? Where can i find information about this? Regards Wilfried
schnootle
schnootle
i wanted to do something similar, use a 16 bit ddraw surface as a z-buffer in my software renderer that ran in 8bpp mode. I couldn''t find a way to have offscreen surfaces with a different bit depth to the primary surface
MichaelT
MichaelT
It won''t distort if you pay attention on this issue:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/gettingstarted/3dcoordinatesystems/rasterizationrules.asp

____________________________________________________________
Treat others the way you want them to treat you!!
No no no no! :)
nvissing
nvissing
To use palettized images in Direct draw can be used and has some advantages. Not only does the images take less space on disk, but you have the advantage to change the palette at any time and make some nice palette animations.

Create a bitmap and fill its info with the necessary information, and copy the palette data.

Then you get the surface device context, and let gdi take over the copy.

HDC hdc;
image->ImageSurface->GetDC(&hdc);

SetDIBitsToDevice(hdc, 0, 0, image->Width, image->Height, 0, 0,
0, image->Height, image->ImageBits, bmi, DIB_RGB_COLORS);

image->ImageSurface->ReleaseDC(hdc);

MemFree(bmi);

WW
WW
Ok, but this doesnt mean my surface is 8bpp now, right?

Loading 8bpp image data is no trouble, neither converting it and getting it into 32bpp surfaces. But 32bpp surfaces need alot of video memory, and i want good performance. So it would be cool if i could use mixed surface types; some 8bpp, some 16bpp, and some 32bpp, all on the video memory.

But i believe that''s not possible. At least it doesn''t seem to work for me.

Regards
Wilfried

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.