I am creating a drawing application that displays OpenGL when it receives WM_SCROLL or WM_MOUSEMOVE. The fact is that there are many mouse movements, and I only need them to display a maximum of 60 frames per second. So I created a bool in my engine class called CanRender. so in my render () proc I do: if (! CanRender) {return; } CanRender = false;
This basically prevents rendering of more than 60 FPS.
I am creating a timer in WM_CREATE.
when I get WM_TIMER, I set CanRender to true.
I made a beep, so I know the timer is working. As soon as I start scrolling or moving the mouse, the beep stops and I no longer see the rendering. Why does he stop my timer? Also, when I minimize the timer, it starts again and then deletes it again, it stops again.
thank
Pump Message:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
Creature:
case WM_CREATE:
SetWindowText(hWnd,engineGL.current.caption.c_str());
SetTimer(hWnd,
120,
17,
(TIMERPROC) NULL);
source
share