Rendering stops when window loses focus

crankyslap

30-09-2012 12:12:24

Mogre (and Ogre) stop rendering when the main window loses focus. I have two monitors and I want Mogre to keep on rendering while I'm doing other stuff on the computer.. is this possible? Note that I don't mean it stops rendering when I *minimize* the window, which wouldmake sense, but when it no longer has focus... which doesn't make any sense at all :wink:

crankyslap

06-10-2012 14:28:34

Ok I almost got it through http://www.ogre3d.org/forums/viewtopic.php?f=2&t=37629, I took this code:

/* Render */
Ogre::WindowEventUtilities::messagePump(); //Eihort 1.4
mDevice->ogre->renderOneFrame();
if(!mDevice->rwindow->isActive() && mDevice->rwindow->isVisible())
mDevice->rwindow->update(); //even in background !

And converted it to:

WindowEventUtilities.MessagePump();

//Root mRoot = mStateMgr.Engine.mRoot;
//mRoot.RenderOneFrame();

RenderWindow rwindow = mStateMgr.Engine.Window;

if (!rwindow.IsActive && rwindow.IsVisible)
rwindow.Update(); //even in background !

It seems to do the trick, but as you can see I commented out the Root->RenderOneFrame(); part because I can't access mStateMgr.Engine.mRoot due to it's protection level... it seems to render in the background just fine regardless, but since it's in the c++ code I assume it's important.. can anyone explain/provide a solution?