Archived

This topic is now archived and is closed to further replies.

l_ahriman

minimizing gl window

Recommended Posts

The processor should be at 100% while the program is running. When you minimize it you''ve not changed anything.

Share this post


Link to post
Share on other sites
quote:
Original post by skow
The processor should be at 100% while the program is running. When you minimize it you''ve not changed anything.


i''m a very beginner so i might be wrong but there is [active] variable which determines if program is active or not. When [active] is zero no drawing is being performed ( i understand it this way ) :

//if ((active && !DrawGLScene()) || keys[VK_ESCAPE])//
( assuming that checking conditions is done from left to right, doesn''t it? )

so what''s going on with that processor usage?

btw: when window is active my processor usage is about 5% but when i minimize it usage raises to 100%

Something must be wrong but what?

Share this post


Link to post
Share on other sites
quote:
Original post by skow
The processor should be at 100% while the program is running. When you minimize it you''ve not changed anything.


Actually it has, why render if the app is minimized? What changed is the user minimized for a reason and the reason isn''t to have the app still rendering.

l_ahriman:
It should be something like this:
In your message procedure have something like this:

case WM_ENTERSIZEMOVE:
Active = false;
break;
//

case WM_SIZE:
if(Windowed)
{
if(wParam == SIZE_MAXHIDE || wParam == SIZE_MINIMIZED)
{
Active = false;
}
else
{
Active = true;
}
}
break;
//

case WM_EXITSIZEMOVE:
Active = true;
break;


Then in the message pump have something like this:

BOOL RecievedMessage;
MSG Message;

PeekMessage(&Message, NULL, 0U, 0U, PM_NOREMOVE);
while(Message.message != WM_QUIT)
{
if(Active)
{
RecievedMessage = PeekMessage(&Message, NULL, 0U, 0U, PM_REMOVE);
}
else
{
RecievedMessage = GetMessage(&Message, NULL, 0U, 0U);
}
//

if(RecievedMessage)
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
else
{
if(Active)
{
Render();
}
else
{
WaitMessage();
}
}
}
//

return (int)Message.wParam;


That should take it to 0% when the app gets minimized.

-UltimaX-
Ariel Productions
|Designing A Screen Shot System|

"You wished for a white christmas... Now go shovel your wishes!"

Share this post


Link to post
Share on other sites
BTW:
//if ((active && !DrawGLScene()) || keys[VK_ESCAPE])//
( assuming that checking conditions is done from left to right, doesn''t it? )

Yes, it checks each condition from left to right. What your basically saying is:
"If my application is active and rendering the current scene returned false or the escape key was pressed then ...(Close the application?)"

-UltimaX-
Ariel Productions
|Designing A Screen Shot System|

"You wished for a white christmas... Now go shovel your wishes!"

Share this post


Link to post
Share on other sites