Why resizing window causes OnCreateDevice() to be invoked?,
Members - Reputation: 96
Posted 24 February 2012 - 04:11 AM
I move a CloneMesh() function which is in OnCreateDevice() originally to OnResetDevice(), and release it in OnLostDevice().
Is that because not all memory in POOL_DEFAULT are released, then DXUT will return to call OnDestroyDevice() and OnCreateDevice()?
Members - Reputation: 336
Posted 24 February 2012 - 04:47 AM
Before you reset or release the device, you must release all the memory but in D3DPOOL_MANAGED (e.g. D3DXLoadMeshFromX function creates meshes in D3DPOOL_MANAGED). After resetting or recreating, you must recreate corresponding memory.
Members - Reputation: 1454
Posted 24 February 2012 - 08:25 AM
Maybe you would read this thread:
Another reason for recreating the device would be an unreleased interface from previous device state.
(simply something was not released on LostDevice callback and D3D forces recreation because of the invalid state)