Archived

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

blondie

Regaining focus in Fullscreen?

Recommended Posts

blondie    122
I''m working with DX8 in fullscreen for the first time, and there''s one problem that I''m stuck on. When my app loses focus (eg. Alt-Tab), and then regains it (eg. clicking on taskbar), my rendering stops working. Upon regaining focus, my dummy cover window pops up as it should, but my fullscreen output does not appear, even though my render loop is still running. I''ve looked at several tutorials from Drunken Hyena, but none of them handle this situation properly. The DX8 docs and MSDN have been no help either. Is there some trick to getting a fullscreen app to "wake-up" properly? Any suggestions would be greatly appeciated! -Quinn

Share this post


Link to post
Share on other sites
Digital Extent    127
I''ve actually got this to work, in form of classes. Basically, you will have to use the TestCooperativeLevel from your D3D Device. If it failed, it will return 2 values either "lost" or "notreset". When it is "lost" that mean it no longer has focus so your rendering have to wait. When it got focus again, you will need to reset it. Before calling the D3D Device Reset function however you have to release all of your device dependant objects (i.e. vertex buffers, textures, etc). Then call the Reset function. After that you have to recreate all of those you just release! I know it''s a pain, but...

I will probably right tutorials on this soon and post it on www.digitalextent.com

Share this post


Link to post
Share on other sites
blondie    122
Thanks for the help!

I gave that a whirl, but I''m still having problems. I''m not allocating anything in D3DPOOL_DEFAULT, but I am creating one RenderTarget, which I release before attempting to Reset.

No matter what I do, though, Reset fails. I can''t figure out why! I''m allocating 4 textures in D3DPOOL_MANAGED, but the docs say those don''t have to be released before Reset, so what else could be wrong?

-Quinn

Share this post


Link to post
Share on other sites
blondie    122
Okay, after some research on flipcode, I think I have the answer. I''m not releasing and restoring the ID3DXSprite object. Silly me, I figured it was smart enough to do that on its own, since it''s an integrated component.

Of course, to do make those calls, you need Direct X 8.1, which I am downloading now. Then we''ll see if it fixes my problems. :-)

Q

Share this post


Link to post
Share on other sites
blondie    122
As is often the case, the act of building a small test case of my problem to post here actually showed me the solution.

I did need to do the ID3DXSprite goo I mentioned above, but the truly elusive problem was that in a deep dark corner of my engine, I was calling GetRenderTarget to fetch a pointer to my main backbuffer. Well, since DX wisely reference counts such things, it knew I had that pointer hanging around out there after video memory was long since invalid.

Whee! Problem solved. Fullscreen alt-tabbing now works like a charm. Thanks for all the help from gamedev folks!

Q

Share this post


Link to post
Share on other sites