• Advertisement

Archived

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

Clear the buffer

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

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
Advertisement
m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(R,G,B), 1.0f, 0);

Just change R,G,B with UCHAR values

---------------------------------------------
If God with me, Who against me?
Sitio de desarrollo de videojuegos en español
Digital Moon Studio...

There is no spoon

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

  • Advertisement