Jump to content
  • Advertisement
Sign in to follow this  
MTclip

finding possible adapter settings

This topic is 4515 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 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
Advertisement
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]

hth
Jack

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++ )
{
D3DADAPTER_IDENTIFIER9 adapterID;
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;
}

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

// 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
Sign in to follow this  

  • 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!