GetPixelFormat borks in 8-bit...

Started by
3 comments, last by Replicon 18 years, 10 months ago
I'm running my game in 640x480, 8-bit, non-paletized mode, and for some reason, GetPixelFormat() is just leaving the "dw[RGB]BitMask" field at zero (it works fine in 16- and 32-bit modes). Why is this?
Advertisement
So what format are you using? I'm pretty sure my graphics card doesn't support any 8-bit RGB modes.
Perhaps it's a grayscale mode or something, the pixel format structure has bitfield which indicates the color format if you need to check programmatically.
Quote:Original post by doynax
So what format are you using? I'm pretty sure my graphics card doesn't support any 8-bit RGB modes.
Perhaps it's a grayscale mode or something, the pixel format structure has bitfield which indicates the color format if you need to check programmatically.


Well, I set it to 8-bit because all the bitmaps I'm using are 256 colours, and there's no point in doubling your video memory needs (even though I could easily just change the stupid thing to 16 and it works fine).

Under 8-bit, it has no problems loading my bitmaps and blitting them around and everything. I just encountered this problem when I tried to do a color fill, which requires a colour value... I think 8 bit color has [RRRGGGBB] format or something, but I could be wrong... But anyway, I figured since I'm planning to reuse a lot of the code for later projects, it might as well figure out how to decide how many bits per color there are, and what offset each should use. Is 8-bit color special, in that sense? Like, if all I want is a RGB(r, g, b) function that gives me a pixel value?
Quote:Original post by Replicon
Is 8-bit color special, in that sense? Like, if all I want is a RGB(r, g, b) function that gives me a pixel value?
8-bit display most almost always refer to a palettized mode, though you claimed not to be using one.
And if it isn't then I suppose it you could be using just about anything, perhaps an YUV or grayscale format. Though I don't see how you could even request one from DirectX as a display mode.

Keep in mind that any possible such format could easily be emulated with an appropriate palette.
Yeah, I played with it, and it looks like it loads some random color palette or whatever. ugh... :) thanks!

This topic is closed to new replies.

Advertisement