I'm working on a MDI app wich one of the windows is an OpenGL interface. Im doing the redraw stuff in the wm_paint but unless I don't make an InvalidateRect(); the scene doesn't refresh.
The problem is that, by doing InvalidateRect, the cpu usage goes up to almost 99%.
Is there any other way of doing this without the cpu usage?
Thanks in advance!
Re: CPU Usage
Depends on what OpenGL implementation you're running. If the glGetString (GL_VENDOR) and glGetString(GL_RENDERER) returns Microsoft's implementation, everything is drawn with the CPU.
If you're on a hardware implementation, it still depends on what you're doing and how fast your host is.
It's normal that continually rendering OpenGL as fast as you can will max out the CPU on fast hardware. That is why it's a bad idea to render in the idle loop for non-game apps, like the NeHe examples do.
I understand that you're doing it the recommended message handling way. If you want to have a reduced load in a continually animating window, you could add a WM_TIMER handler and setup a timer event which refreshes at a lower rate. During the repaint the OpenGL driver might still max out your CPU during that time, because it's designed for maximum speed, not for low CPU load.