PDA

View Full Version : OpenGL, MFC, and Run



Syslock
10-30-2002, 10:59 PM
How do you -correctly- override the Run message loop to allow real-time
OpenGL rendering?

It needs to behave properly (e.g. update the UI, idle processing, not
suck up the CPU, etc..) like a normal MFC app.

I have something going, but it is badly hacked up. I'm looking for
something that anyone can use without problems.

mikael_aronsson
10-31-2002, 12:09 AM
Hi !

One way is to take the existing run() code from the MFC source code and modify it the way you want, another way is to put your rendering code in the idle() handler.

You could do something like this:
Use PeekMessage to look for any messages in the queue and use the PumpMessage() method to handle them, the rest is up to you.

Mikael

J P
10-31-2002, 01:22 PM
Try bypassing the MFC message loop http://www.mfcogl.com/ I'd like to know if this is what you're looking for.

Syslock
10-31-2002, 02:01 PM
One way is to take the existing run() code from the MFC source code and modify it the way you want, another way is to put your rendering code in the idle() handler.


That's basically what I did, but there's a lot of messy undocumented MFC code
in there, and I'm not sure if my hacked version is taking care of everything.



Try bypassing the MFC message loop


Not sure what you mean by bypassing? Overriding the Run function is the only
way to get real-time OpenGL (e.g. animation, etc.) rendering. I looked at
that site, but none of those examples override Run.