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 6820955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:29:15+00:00 2026-05-26T21:29:15+00:00

I am currently programming a graphics application with OpenGL and the Windows API in

  • 0

I am currently programming a graphics application with OpenGL and the Windows API in C++. Unfortunately the image freezes under certain conditions, such as when I’m resizing the window, and/or when my mouse isn’t moving. Is there some sort of mechanism I can use in Win32 to ensure that the frames are constantly being processed?

Here’s some pseudocode describing the basic flow of my program

Main Loop

while(running)
{
    if (PeekMessage(&Msg,NULL,0,0,PM_REMOVE))   
    {
        if (Msg.message==WM_QUIT)               
        {
            SetRunning(false);                  
        }
        else                                    
        {
            TranslateMessage(&Msg);             
            DispatchMessage(&Msg);              
        }
    }
    else
    {
        SwapBuffers(deviceContext);
    }
}

WndProc

switch(msg)
{

case WM_CLOSE:
{
    PostQuitMessage(0);
    break;
}

case WM_SIZE:
{
    ResizeScreen(LOWORD(lParam),HIWORD(lParam));
    break;
}

}

return DefWindowProc(hwnd, msg, wParam, lParam);

EDIT: I read the tutorial Kol linked to and made some edits, and now the frame rate is consistent even when the mouse is not moving. However the image still freezes when I’m moving or resizing the window, so I’d appreciate help on that.

  • 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-26T21:29:16+00:00Added an answer on May 26, 2026 at 9:29 pm

    Read the NeHe site to learn the basics of OpenGL with Win32. There are detailed explanations about how the message loop should look like, what the WM_SIZE handler should do etc.

    EDIT

    The code which draws the scene and the buffer swapping should be put into the message loop, in an else branch after the if (PeekMessage(...)) branch. See where the DrawGLScene() call is in the above mentioned NeHe example.

    EDIT2

    The problems were the followings:

    • The scene renderer function was not called in the WM_SIZE and WM_MOVE handlers.
    • The scene was drawn only once a second.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently programming a scheduling application which loosely based on iCalendar standard. Does
I'm new to OpenGL and graphics programming in general, though I've always been interested
I'm currently programming an application for the Android. Now what I found out is
I am currently programming a ASP.NET MVC3 application, using Entity Framework 4. There are
I'm currently programming a web application that can be embedded. I'm wondering if it
I'm currently programming very simple game for Android (API level 7) to discover and
I'm currently programming an application in Silverlight which need to have a control to
I'm currently programming on an eclipse RCP application in Java for an university project.
I am currently programming a background-image using PHP with a color gradient for all
I'm currently programming a Rails application locally using RVM. Now I want a designer

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.