Archived

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

Sizing direct3d-window ....

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

Hi, I wrote a resize function that invalidates texture, resizes the device and changes the window-size, and at the end restores the textures. But if i call the function that windows which are in the background of my window are not redrawed and so if my window gets smaller, you can see the last rendered frame of my old window. Does anyone have a solution?

Share this post


Link to post
Share on other sites
Have you used the D3DDevice.Clear function to clear before each render?

The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Share this post


Link to post
Share on other sites
yes i have used the clear-function.

my resizing function is:

int CMyDirect3D::Resize3DEnvironment( RECT rcClient, RECT rcBounds )
{
HRESULT hr;

// Restore the Device Objects with the function that is saved
// in this function-pointer.
if( MYDIRECT3D_OK != lpfnInvalidDeviceObject( ) )
return MYDIRECT3D_INVALIDDEVOBJFAILED;

RECT rcClientOld;
rcClientOld = m_rcWindowClient;

// Update window properties
m_rcWindowBounds = rcBounds;
m_rcWindowClient = rcClient;

if( rcClientOld.right - rcClientOld.left !=
m_rcWindowClient.right - m_rcWindowClient.left ||
rcClientOld.bottom - rcClientOld.top !=
m_rcWindowClient.bottom - m_rcWindowClient.top )
{
// A new window size will require a new backbuffer
// size, so the 3D structures must be changed accordingly.

m_d3dpp.BackBufferWidth = m_rcWindowClient.right - m_rcWindowClient.left;
m_d3dpp.BackBufferHeight = m_rcWindowClient.bottom - m_rcWindowClient.top;

// Resize the 3D environment
// Reset the device
if( FAILED( hr = m_pd3dDevice->Reset( &m_d3dpp ) ) )
{
DisplayErrorMsg( D3DAPPERR_RESIZEFAILED, MYDIRECT3D_NONE );
return MYDIRECT3D_RESIZE3DENVFAILED;
}

// Store render target surface desc
LPDIRECT3DSURFACE8 pBackBuffer;
m_pd3dDevice->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
pBackBuffer->GetDesc( &m_d3dsdBackBuffer );
pBackBuffer->Release();
}

// Restore the Device Objects with the function that is saved
// in this function-pointer.
if( MYDIRECT3D_OK != lpfnRestoreDeviceObject( ) )
return MYDIRECT3D_RESTOREDEVOBJFAILED;

return MYDIRECT3D_OK;
}

Share this post


Link to post
Share on other sites
now, this is a big of a guess but here goes...

your problem that you posed is this (correct me if I''m wrong):
when YOUR window is made smaller, the other windows which are
behind it aren''t redrawn, and so the old stuff that was in
your window, stays on the screen - right?

that means that you have to get Windows to tell the other
windows to redraw themselves.
This is a win32 API question I reckon - but I could be wrong.
consult the API

sorry I couldn''t be more helpful though.

Share this post


Link to post
Share on other sites