Archived

This topic is now archived and is closed to further replies.

lwinkenb

Clear the buffer

Recommended Posts

Im trying to clear the screen to black, and the following is the code Im using.
m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
                         D3DCOLOR_COLORVALUE(0.0f,0.0f,0.0f,1.0f), 1.0f, 0 );
 
That code works fine in full screen mode, but it turns the screen green in windowed mode. What code can I use to clear the screen in both full screen AND windowed mode?

Share this post


Link to post
Share on other sites
I gave that a try, but it still only turns the background green in windowed mode. Maybe the problem isnt with my call to clear?

This is how I init d3d in windowed mode:


m_pD3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DDISPLAYMODE d3ddm;
if( m_pD3D == NULL )
{
return FALSE;
}

ZeroMemory(&d3ddm, sizeof(d3ddm));
if(FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
{
return FALSE;
}
d3dpp.Windowed = TRUE;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

if( FAILED( m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &m_pd3dDevice ) ) )
{

return FALSE;
}



[edited by - lwinkenb on November 17, 2003 1:41:47 PM]

Share this post


Link to post
Share on other sites