WM_PAINT and OpenGL
Ever since I started using OpenGL inside my program, I started getting a ton of WM_PAINT messages. Is there a way to limit the amount of paint messages that are sent to my application? Im trying to limit the amount of CPU cycles that my application takes up and currently, its eating up a nice chunk.
In about 5 seconds, my program recieved about 100,000 paint messages.
Before it was only a few hundred.
For the purpose of this project, I need to have the openGL render calls inside the message loop in the WM_PAINT portion. Im NOT going for the best fps here, only selective rendering.
Here is my Main Loop code:
And then the WndProc picks up any messages.
while (GetMessage(&uMsg, NULL, 0, 0))
First its not the best idea to use openGL calls in WM_PAINT messages. Second, I suggest you go to http://nehe.gamedev.net and check out his openGL tutorials to see how to write a rendering loop without relying on paint messages.
thats the thing. Im not writing a rendering engine. I actually want openGL to render when windows refreshes the window. I want as few FPS as possible. (i know how strange that sounds).
This program is a utility, and I dont want to bogging down the CPU.
Using WM_PAINT will bog down the CPU, if you implement the rendering sepretly it will not use the cpu (as long as you have a 3d card capable of accelerating the basic gl calls) very much at all.
well heres the thing. even tho i commented out ALL my opengl code. the app still takes up 50% of the cpu power. its recieving a TON of pain calls.
Call ValidateRect(Window, NULL); when WM_PAINT is sent.