Multithreaded Rendering

I read recently that using PeekMessage() to avoid program delays is bad practice and any task that requires you to use PeekMessage() instead of GetMessage() should be run in it`s own thread. Could this be done in an OpenGL app by doing all rendering in a separtate thread?


Well, the question is WHO said using
PeekMessage() is bad? For most applications,
PeekMessage() is bad. However, for GAME
applications, it’s the way it’s usually
done. What’s right for a database front-end
is not necessarily right for a third-person
puzzle-based racing simulator. Or something.

A warning: PeekMessage with PM_NOREMOVE can cause trouble. Some apps use this and then call GetMessage, but Windows can grab a message out of the message queue before you get to it. PM_REMOVE is the safe way to go.

  • Matt