View Full Version : OpenGL/MFC animation

01-22-2002, 07:35 AM
I am writing a small program with OpenGL and MFC and am now a little lost with the concept of animation. What is the best way to use the MFC to produce a constantly updated screen? Should I use a timer, or refresh the screen inside the OnPaint function? Or something else I haven't thought of yet?

01-22-2002, 09:10 AM
You can call refresh in the CWinApp::OnIdle function. Use a high resolution timer, like timeGetTime() or QueryPerformance*() to determine when refresh is due and, when it is due, refresh your screen. timeGetTime() returns the time accurate to 1ms so you would check if the difference in time between the time of last refresh and the current time warrants another refresh.

01-22-2002, 02:27 PM
Take a look at http://p-squared.com/Display3DS.zip

It uses MFC to decode and display 3D Studio MAX meshes using a timer to paint the screen at periodic intervals.

Hit the 'Fly By' menu option to see a simple, animated camera movement.

Maybe it's useful to what you're trying to do...

[This message has been edited by ppinter1 (edited 01-22-2002).]