using RenderOneFrame() instead of StartRendering() problem

kerozcak

03-02-2008 00:11:59

I have problem using mRoot.RenderOneFrame() in loop, instead of using mroot.StartRendering() (I want window to be rendered even if it doesn't have focus).
I'm not using MogreFramework nor Windows.Forms. Code is similar to ExampleApplication.
I thought i would set mRenderWindow.IsActive to True and then call RenderOneFrame() in loop. But there is the problem with IsActive even if i'm not setting it anywhere:
Method 1):
public void Start()
{
int i = 0;
if (!Setup()) return;

mRoot.StartRendering();
}

When i use method 1) everything is fine, and when i change focus to other window i see that Ogre window stopped rendering (i guess it's because mRootWindow.IsActive has been set to false).
Method 2):
public override void Start()
{
int i = 0;
if (!Setup()) return;

//mRoot.StartRendering();
while (true)
{
Console.WriteLine(mRenderWindow.IsActive + " " + " " + mRenderWindow.IsVisible + " " + i++);
if (i > 10) i = 0;
if (!mRoot.RenderOneFrame())
break;
}
}

When i use method 2) and change focus to other window, Ogre window keeps rendering frames, but i see in Console window that mRootWindow.IsActive is still set to True, and when i want Ogre window get back, it doesn't show up. Also, using this method, i can't move Ogre window around the screen.

I have no idea why it works that way, because StartRendering() method seems to be almost the same as RenderOneFrame() in loop (you can see that in OgreRoot.cpp, line 722).

I would appreciate any help.

kerozcak

05-02-2008 17:04:28

solved.

daedius

16-02-2008 20:52:05

What did you do to solve this?

Ultima2876

19-02-2008 17:20:19

solved.

You sir, are a dick of monumentally epic proportions.

People who do this should be hung, drawn and quartered, then their remains sent to a desert island where they are subjected to an eternity of nuclear testing.

Thanks and have a good day, asshat.

[If you don't know what I'm talking about - ALWAYS post how you solved it >_>]

kerozcak

20-02-2008 02:21:18

What did you do to solve this?

I'm sorry, i was going to explain later and forgot to do it...

I forgot to add some function calls, that i found later in OgreRoot.cpp, but key was WindowEventUtilities.MessagePump();

This is working code:
public override void Start()
if (!Setup()) return;

mRoot.RenderSystem._initRenderTargets();
mRoot.ClearEventTimes();
while (true)
{
WindowEventUtilities.MessagePump();
if (!mRoot._fireFrameStarted())
break;
mRenderWindow.Update();
if (!mRoot._fireFrameStarted())
break;
}
}


I think you can replace
if (!mRoot._fireFrameStarted())
break;
mRenderWindow.Update();
if (!mRoot._fireFrameStarted())
break;


with

if (!mRoot.RenderOneFrame())
break;