[color="#1C2837"]Hello! I'm using the June 2010 release of DirectX on Visual Studio C++ 2010.
[color="#1C2837"]
After spending the whole day trying to make the project link (essentially ran into this problem [color="#1C2837"](http://www.gamedev.n...les-with-dx90c/)[color="#1C2837"]) now the project compiles, but I just get a black screen. I tracked down the problem to the GetAdapterCount() always returning zero and therefore not building a device list. I looked this up online, but I only found some reference to the OS sometimes being at fault in some systems?! Any ideas of where to go from here?
[color="#1C2837"]
HRESULT D3DApplication::BuildDeviceList()
{
const DWORD dwNumDeviceTypes = 2;
const TCHAR* strDeviceDescs[] = { _T("HAL"), _T("REF") };
const D3DDEVTYPE DeviceTypes[] = { D3DDEVTYPE_HAL, D3DDEVTYPE_REF };
BOOL bHALExists = FALSE;
//BOOL bHALIsWindowedCompatible = FALSE;
BOOL bHALIsDesktopCompatible = FALSE;
BOOL bHALIsSampleCompatible = FALSE;
/* debug code
UINT adapterCount = m_pD3D->GetAdapterCount();
if(adapterCount == 0)
{
return 0; <<<<<-------always exits here
}else if(adapterCount == 1)
{
return 1;
}*/
// Loop through all the adapters on the system (usually, there's just one
// unless more than one graphics card is present).
for( UINT iAdapter = 0; iAdapter < m_pD3D->GetAdapterCount(); iAdapter++ )
{
// Fill in adapter info
.........
GetAdapterCount() always returns 0
Is your DirectX interface initiated before you are trying to GetAdapterCount() ??
Yes, the interface is initiated. It only FAILED BuildDeviceList() (which called GetAdapterCount() unsuccessfully):
HRESULT D3DApplication::InitializeDirect3D()
{
HRESULT hr;
m_hWnd = GetAppWindow();
// Create the Direct3D object
m_pD3D = Direct3DCreate9( D3D_SDK_VERSION );
if( m_pD3D == NULL )
return DisplayErrorMsg( D3DAPPERR_NODIRECT3D, MSGERR_APPMUSTEXIT );
if( FAILED( hr = BuildDeviceList() ) )
{
SAFE_RELEASE( m_pD3D );
return DisplayErrorMsg( hr, MSGERR_APPMUSTEXIT );
}
..........
[s]This is really just a guess, but you may need to CreateDevice() before you check GetAdapterCount()[/s]
edit: i looked into it and this information is wrong, sorry about that.
edit: i looked into it and this information is wrong, sorry about that.
Try making a test application outside of your class that inits d3d then calls GetAdapterCount() see if it still returns zero, it might be a bug with your driver or video card.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement