Sign in to follow this  
Replicon

GetPixelFormat borks in 8-bit...

Recommended Posts

Replicon    306
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?

Share this post


Link to post
Share on other sites
doynax    850
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.

Share this post


Link to post
Share on other sites
Replicon    306
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?

Share this post


Link to post
Share on other sites
doynax    850
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this