Sign in to follow this  
Mastadex

Restoring Meshes, Lights, etc.

Recommended Posts

Hi. Im working with meshes, bones and animations (basic .X files). I used the MS provided code as an example and it works great now. The problem Im having now, is how do I restore a complex mesh (with animation, bones etc) after the window get minimized. I do have the code to check WHEN to restore all my objects (testing cooperative level etc) and it works fine. Im having problems reconstructing my meshes, lights, etc after a minimize. (assume im doing everything in fullscreen mode)

Share this post


Link to post
Share on other sites
When it comes to resets, remember that you only need to worry about your resources in the default pool and any device states. For example, if you create a vertex buffer in the default pool, and the device was lost, the entire contents of that buffer are now lost too. Using the managed pool is generally a lot easier, since it keeps a backup of the data in system memory, so when your video memory gets wiped out by a device reset, it can automatically restore it.

As far as your lights go, it would probably be easiest to keep another copy of them. This way, they are easy to update, and easy to restore.

With that said, it would probably be most convienent to have all of your stuff that can be reset by a device loss to be initialized in a function like 'InitAfterReset(). This way, when you first start your application, you can call that function. Then, when you reset your device, you call that same function. In short, you can use the same code twice: both for initialization purposes and for re-creating after device loss.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this