updating window in multithreaded app

okay im making a mesh viewer for my engine in c#. Now my engine runs in a window, parented to a window in my c# application.

My engine runs in its own thread started by my c# application. When i've finished rendering i tell opengl to swap buffers, which would normally display the contents to window, however in my c# appliation it does not update the window.

How ever, if i put a call to my engine's render function in the windows paint method, it will be displayed, but only when i resize the window.

Any ideas how to get the window updated each frame in my seperate engine thread

edit:
okay i made some progress, i now open a thread which invalidates the window then sleeps for 20ms. This seems to work nicely. Is it the best way to go about it




Answer this question

updating window in multithreaded app

  • Todd Foust

    You probably are in the right direction. Only glitch that I feel is the 20ms thingy. You should invalidate the window for every frame. The moment you swap the buffers, you should invalidate the window.
  • updating window in multithreaded app