Advertisement

A question

Started by July 13, 2002 08:16 AM
0 comments, last by Krivonos 22 years, 7 months ago
Why while the OpenGL program is in Iconic (minimized) mode the processor is loaded for 100% ? Proud to be a member.
-------Proud to be a member.
You're probably still processing your message loop. A quick solution is:

First, declare a global variable called
bool bMinimised = false;
or something similar, and make sure it can be accessed by both your message loop and your WndProc.

In your WndProc:


      case WM_ACTIVATE:    {        if (LOWORD(wParam) == WA_INACTIVE)        {            bMinimised = true;        }        else        {            bMinimised = false;        }    }    break;  


Now, in your message loop, add the marked code from below:


  if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE)){    if (Msg.message == WM_QUIT)    {        break;  // Or however else you exit your message loop    }    TranslateMessage(&Msg);    DispatchMessage(&Msg);}else{    // ADD OR MODIFY THE BIT OF CODE BELOW    if (!bMinimised)    {        // Perform normal rendering etc. here    }    else    {        WaitMessage();    }}  


I think that should work.

[edited by - sibbo2001 on July 13, 2002 9:30:57 AM]

This topic is closed to new replies.

Advertisement