[SOLVED] The rendering cycle

Kwang1imsa

18-03-2011 14:30:06

I'd like to make a rendering cycle with a while loop that uses Root.renderOneFrame() without freezing up my window.

How does startRendering's cycle work? startRendering does not freeze up the window but my

while(root.renderOneFrame()){
}


does.

McDonte

18-03-2011 16:45:37

Are you using Windows.Forms? If yes the approach from the old Basic Tutorial 6 (now Embedding Mogre in Windows.Forms) should work for you:


Show();
while (mRoot != null && mRoot.RenderOneFrame())
Application.DoEvents();


If you are are using only a plain Ogre render window then everything needed will be done by Ogre itself.

Kwang1imsa

19-03-2011 17:28:04

I'm using OGRE's Window.

I need to have the code arranged like this:


while (!OGREWin.IsClosed)
{
if(!mRoot.RenderOneFrame()){
break;
}
}


OGRE is not dispatching its events.

smiley80

21-03-2011 08:26:19

while (!OGREWin.IsClosed)
{
if (!mRoot.RenderOneFrame())
{
break;
}

WindowEventUtilities.MessagePump();
}

Kwang1imsa

22-03-2011 14:04:18

while (!OGREWin.IsClosed)
{
if (!mRoot.RenderOneFrame())
{
break;
}

WindowEventUtilities.MessagePump();
}

Thanks a MILLION, smiley. This is perfect, you've been an immense help. :)