• Advertisement
Sign in to follow this  

DirectX Questions !

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

What is the best way of handling lost focus? What are the advantages and disadvantages? 1. WM_SETFOCUS/WM_KILLFOCUS or 2. WM_ACTIVATE/WM_ACTIVATEAPP What is the difference between DX Input and GDI Input? What are the advantages and disadvantages? 1. WM_LBUTTONDOWN/WM_LBUTTONUP or 2. DX INPUT? Does DIRECTX 10 handles 'Lost Devices'? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I handle lost devices before rendering, without the windows message system.


BOOL DXUT_CALL dxutCore::Render()
{
COMPtr<IDirect3DDevice9> pD3DDevice( dxutGetD3DDevice() );

if ( SUCCEEDED( pD3DDevice->TestCooperativeLevel() ) )
{
if( SUCCEEDED( pD3DDevice->BeginScene() ) )
{
pD3DDevice->Clear( 0, 0, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, D3DCOLOR_COLORVALUE(0.35f, 0.53f, 0.7, 1.0f), 1.0f, 0 );

std::for_each(
GRAPHIC_PIPELINES.begin(),
GRAPHIC_PIPELINES.end(),
std::mem_fun( &dxutRenderStep::OnRender ) );

pD3DDevice->EndScene();
pD3DDevice->Present( NULL, NULL, NULL, NULL );
}
}
else
{
if ( pD3DDevice->TestCooperativeLevel() == D3DERR_DEVICELOST )
{
Sleep( 50 );
}

if ( pD3DDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET )
{
dxutCore::ResetDevice();
}
}

return TRUE;
}

Using WM_LBUTTONDOWN/WM_LBUTTONUP will hard-couple the app with the windows message system, thus making it less easy to port later.

DirectX10 will not have lost devices anymore.

Share this post


Link to post
Share on other sites
Just a quick reply from me:
Quote:
Original post by denthorq
Does DIRECTX 10 handles 'Lost Devices'?

There are NO lost devices in Direct3D 10. There is a "Device Removed" event - but thats highly unlikely to occur in a desktop environment as it's more for laptops with docking stations (etc..)

hth
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement