Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 892947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:08:31+00:00 2026-05-15T14:08:31+00:00

I’m creating a drawing application that renders OpenGL when it gets a WM_SCROLL or

  • 0

I’m creating a drawing application that renders OpenGL when it gets a WM_SCROLL or WM_MOUSEMOVE. The thing is that there are a lot of mouse moves and I only need it to render 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;

Basically it prevents it from rendering more than 60 FPS.

I create the timer in WM_CREATE.

when I get a WM_TIMER I set CanRender to true.

I made it beep so I know the timer is running.
As soon as I start scroling or moving the mouse, the beeping stops and I no longer see rendering. Why would it stop my timer? Also when I minimize the timer starts again then remaximize, it stops again.

Thanks

Message Pump:

// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
    if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

}

return (int) msg.wParam;

creation:

case WM_CREATE:
    //Set Window Title
    SetWindowText(hWnd,engineGL.current.caption.c_str());

    SetTimer(hWnd,             // handle to main window 
        120,                    // timer identifier 
        17,                     // 60 fps interval 
        (TIMERPROC) NULL);     // no timer callback 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:08:32+00:00Added an answer on May 15, 2026 at 2:08 pm

    Why making it so complicated?

    Drawing in windows application is usually done only in WM_PAINT message and triggered by RedrawWindow function. You can call RedrawWindow within WM_SCROLL and WM_MOUSEMOVE. Multiple calls to RedrawWindow (WM_PAINT messages) will be collapsed if your application can’t keep up with drawing.

    Also if you set OpenGL to synchronize with your monitors vertical retrace you will not exceed certain refresh rate.


    As to your question… I guess there’re many WM_SCROLL and WM_MOUSEMOVE messages. And those cannot be collapsed. So if you do your drawing inside them (which takes time), you block your message queue and WM_TIMER messages cannot be handled. Thus, you don’t hear beeps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.