rakkarage's picture

Application.DoEvents

i create a new Form inside my GameWindow derived class and show it... its not updated unless i add Application.DoEvents to override OnUpdateFrame or something? should the app or game window be doing this or its not doing for performance i guess?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

No, this will not work - WinForms will "steal" events from the GameWindow and vice versa.

The correct solution is to launch the Form on a different thread. If you need more than one Form, make sure that all of them are created on the same thread (and that this thread is different from the GameWindow thread).

rakkarage's picture

thanks ya i was noticing missing events :) esc would not sometimes

krisnye's picture

Just as a side note: Application.DoEvents leaks memory permanently each time it is invoked. That method shouldn't be used.... it's not being used from within OpenTK is it?

the Fiddler's picture

No, OpenTK does not use the Application class at all. It also uses several tricks to avoid allocating memory per-frame - the memory allocation graph for a GameWindow should be completely flat over time.