Sizing direct3d-window ....

Started by
4 comments, last by hajkr 22 years, 4 months ago
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?
Advertisement
Have you used the D3DDevice.Clear function to clear before each render?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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;
}
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.
yes i think that`s right. i think i ask this question in the winapi forum.

This topic is closed to new replies.

Advertisement