• Advertisement

Archived

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

Refreshing surfaces after ALT+TAB

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

Hello, I read that when someone ALT+TABs out of your game, the surfaces stored in video memory are lost. I used the DirectX function RestoreSurfaces () or whatever it is called to restore the memory back when the user returns focus to my game. But I'm kindof stuck on how to restore the actual image, as some of my surface content is created at runtime and I can't restore it from bitmap. I have been trying to find a way to restore the image, and I came up with two ideas... 1.) Save all of the surfaces to temporary bitmaps when focus is lost, and read them in from the bitmaps again when the focus is restored. This would probably be pretty slow. 2.) Create a system memory version of each surface when it is created, blit the video memory surface to the system memory surface when the user alt+tabs out, and then blit the system memory surface back to the video memory surface after focus has been regained. The only problem I can think of is if Windows needs the system memory also and that gets cleaned out. But there is considerably more RAM than VRAM so I don't think I have to worry about this. Which method would be better? Any other ideas? Thanks [edited by - JonWoyame on December 1, 2002 3:40:28 PM]

Share this post


Link to post
Share on other sites
Advertisement
AFAIK loaded bitmaps won''t be deleted until you call DeleteObject or restart windows. I use the second method in the game I am currently working on. But there are only some 10 bitmaps or so...

Share this post


Link to post
Share on other sites
Check the docs on D3DPOOL_MANAGED - I believe this flag handles what you want. Otherwise, method 2 sounds like what you would do, if you want to store stuff in video mem. Method 1 shouldn''t work, methinks, as the information is lost when the device is, so it should be too late to backup the info in system memory.

Share this post


Link to post
Share on other sites

  • Advertisement