Rendering when not the current focus..

Problems building or running the engine, queries about how to use features etc.
jtarbox
Gnoblar
Posts: 12
Joined: Thu Jun 16, 2005 2:20 pm

Rendering when not the current focus..

Post by jtarbox »

I saw someone inquiring about this as well in another thread a bit back so and I was interested in this as well. I basically wanted my application such that if it's not in the foreground and not minimized, it continued to render the scene. So, I investigated this and saw that currently, the D3D7 setup *IS* set to toggle rendering when minimized (a good thing), but also toggled rendering when loosing focus. For my case, I easily disabled the toggle in the focus loss case. However, D3D9 and OpenGL did not toggle rendering anywhere except in the loss of focus case. I had to add this manually.

To do so, I basically used the following chunk of code in the WM_SIZE cases within the two rendered plugins and disabled the focus toggle in all three render plugins.

Code: Select all

      if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
        win->mActive = true;
      else if (wParam == SIZE_MINIMIZED)
        win->mActive = false;
as seen in this test pic, it works fine:
Image
User avatar
Manuel
Gremlin
Posts: 193
Joined: Sat Apr 17, 2004 9:35 pm

Post by Manuel »

You may need to be careful about "device lost" messages, because Ogre is taking care of this for you i think.