Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Detecting RGB 555 or RGB565

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

How would I go about detecting whether a video card uses RGB 555 or RGB565. The computer I use to develop on is 555 but my mothers computer which I use as a test computer uses 565 so my transparency code doesn''t work for hers. Is there any way to detect this? Thanks in advance for help and insight

Share this post

Link to post
Share on other sites
If you''re working with DirectX, you could work with the IDirectDraw7 interface and use IDirectDraw7::EnumDisplayModes to see what the possible display modes are.

Share this post

Link to post
Share on other sites
Use "HRESULT IDirectDrawSurface7::GetPixelFormat(...)".

With the returned structure, you can check how many bits are for red, green, and blue, or check the shifts and masks etc... there are about 100 ways from here to find whether or not it is 565 or 555

Share this post

Link to post
Share on other sites
i use the following code to find the currently running videomode:
(for this to work you need a correctly set up ddraw surface, but it should be easy to adapt the code if you only have an hdc to work with the pixelformatdescriptor from the gdi get/describe pixelformat methods )

// get the pixelformat
memset ( &f, 0, sizeof(f) );
f.dwSize = sizeof(f);
lpddsprimary->GetPixelFormat ( &f );

int bits = f.dwRGBBitCount;
int r = f.dwRBitMask;
int g = f.dwGBitMask;
int b = f.dwBBitMask;

if (bits==32 && r==0x00FF0000 && g==0x0000FF00 && b==0x000000FF) res = Pixelformat_32_RGB_888;
if (bits==32 && r==0x000000FF && g==0x0000FF00 && b==0x00FF0000) res = Pixelformat_32_BGR_888;
if (bits==16 && r==0xF800 && g==0x07E0 && b==0x001F) res = Pixelformat_16_RGB_565;
if (bits==16 && r==0x001F && g==0x07E0 && b==0xF800) res = Pixelformat_16_BGR_565;
if (bits==16 && r==0x7C00 && g==0x03E0 && b==0x001F) res = Pixelformat_16_RGB_555;
if (bits==16 && r==0x001F && g==0x03E0 && b==0x7C00) res = Pixelformat_16_BGR_555;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!