Jump to content
  • Advertisement
Sign in to follow this  

GetPixelFormat borks in 8-bit...

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

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
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.

Share this post


Link to post
Share on other sites
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!