Sign in to follow this  

finding possible adapter settings

Recommended Posts

I am using DirectX9 and c++.. I am trying to get the information like the settings dialog from the directX samples... I looked into the DXUT settingsDialog code but that was line after line of DXUT wrapped DirectX... how can i find the avalible settings for a device? thanks..

Share this post

Link to post
Share on other sites
What you're asking about is more generally referred to as "Enumeration" - there are lots of function calls to check such things.

Is there any specific pieces of information you want to find? If not, just browse IDirect3D9 and IDirect3DDevice9 in the documentation for Check**() and Get**() calls - most of them yield useful bits and pieces [smile]


Share this post

Link to post
Share on other sites
thanks for the reply...

Ive been looking through the sdk before i posted...

what i really want is the valide screen resolutions, refresh rates, and back buffer formats, etc.. The only way it seems possible to do this is to call IDirect3D9::EnumAdapterModes and test each case... is that how its done??

Share this post

Link to post
Share on other sites
I have created this.. someone may find it useful

std::vector< std::string > enumList;

UINT adapterCount = pD3D->GetAdapterCount();
for( UINT adapter = 0; adapter < adapterCount; adapter++ )
pD3D->GetAdapterIdentifier( adapter, 0, &adapterID );

for( UINT formatCount = 0; formatCount < 6; formatCount++ )
D3DFORMAT format;
switch( formatCount )
case 0: format = D3DFMT_A1R5G5B5; break;
case 1: format = D3DFMT_A2R10G10B10; break;
case 2: format = D3DFMT_A8R8G8B8; break;
case 3: format = D3DFMT_R5G6B5; break;
case 4: format = D3DFMT_X1R5G5B5; break;
case 5: format = D3DFMT_X8R8G8B8; break;

UINT modeCount = pD3D->GetAdapterModeCount(adapter, format);
for( UINT mode = 0; mode < modeCount; mode++ )
if( FAILED( pD3D->EnumAdapterModes( adapter, format, mode, &displayMode )))

// fill the data into a string
std::string temp = "";
AppendNumberToString( temp, displayMode.Width);
temp += " x ";
AppendNumberToString( temp, displayMode.Height);
temp += " @ ";
AppendNumberToString( temp, displayMode.RefreshRate);
temp += " hz ";

switch( displayMode.Format )
case D3DFMT_A1R5G5B5: temp += "A1R5G5B5"; break;
case D3DFMT_A8R8G8B8: temp += "A8R8G8B8"; break;
case D3DFMT_R5G6B5: temp += "R5G6B5"; break;
case D3DFMT_X1R5G5B5: temp += "X1R5G5B5"; break;
case D3DFMT_X8R8G8B8: temp += "X8R8G8B8"; break;
default: temp += "UNKNOWN"; break;

enumList.push_back( temp );
// here is the function that appends numbers
template<typename T>
void AppendNumberToString( std::string & rString, T & rNum )
std::stringstream str;
str << rNum;
std::string temp;
str >> temp;
rString += temp;

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