Getting the desktop bit depth

Started by
3 comments, last by Evil Bill 21 years, 11 months ago
Anyone know how to get the bit depth of the screen (pref. a Win32 function)? I need to create a window D3D window, and it fails if the bit depth of the backbuffer is different from that of the screen. Cheers, Steve Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)
Advertisement
I do this:

D3DDISPLAYMODE d3ddm;
if( FAILED( m_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ) ) )
return E_FAIL;

then d3dmm.Format will be what you're after, so can just set the backbuffer format to the same.

look in the sdk for D3DFORMAT for the different types.

[edited by - helicon56 on May 1, 2002 2:47:36 PM]
Hmm... thats what ive got, but i''d prefer a non-D3D way.
The reason being that i''ve got my D3D renderer in a DLL, and i''d prefer not to have a function GetDesktopBitDepth() just to eliminate modes that are different from the desktop bit depth if the window isn''t fullscreen.

Cheers, Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)
i think something like GetDeviceCaps(NULL,BITSPIXEL); will return the bpp, but i''m not sure about getting the format.
Perfect! Thats what i was looking for! I was looking through GetSystemMetrics() but couldn''t find anything - now i know why.

Cheers, Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)

This topic is closed to new replies.

Advertisement