MogreForm doesn't update on Render

boyamer

01-05-2009 21:02:21

I've tried out MogreForm with ParticleFX sample but the Render Control doesn't update?

I think there is a problem because on the Form_Paint it calls root.RenderOneFrame()
any way to have continous rendering?

Please help! :(

AndroidAdam

03-05-2009 20:05:17

Form_paint only gets called whenever the control needs to be painted, usually on start-up or moving the window.

Here's what I'd do.
Method A:
inside of the constructor for form1 write this line beneath "InitializeComponent();"
Application.Idle += new EventHandler(Application_Idle);

inside the Application_Idle method that that generated put:
root.RenderOneFrame();


public form1()
{
InitializeComponent();
Application.Idle += new EventHandler(Application_Idle);

}

void Application_Idle(object sender, EventArgs e)
{
root.RenderOneFrame();
}


this isn't actually that fast of a frame rate, but it lets all of the events and form continue unhindered.

Method B:
Write a for loop that looks this:


while(root.RenderOneFrame)
{
Application.DoEvents();
}


The problem I've noticed with this is that none of the key events ever fire, form runs smoothly and does everything else correct, and you can still get keyboard input with MOIS, but this will render as fast as your computer can.