Skip to main content
GameDev.net gamedev.net
🔒 Locked

quick question about minimizing

Started by bjle Mar 10, 2005 at 11:49 PM 0 replies 550+ views
Original Post
bjle
bjle
(well this turned out to be not so "quick" but if you only want the question, skip to the last line) When I minimize my direct3d program, it begins to eat up 100% cpu and causes my graphics card to emit a high-pitched screetching noise (which can't be good because I don't think those things are supposed to make sounds!). I have only been using Vsync to limit the fps, and it clearly doesn't work when the window is not visible. Placing my BeginScene() through my Present() in an if(isWindowVisible) gets rid of the screetching noise, but not the cpu usage. Putting a Sleep(1) in my main loop worked, but that just doesn't seem "elegant." So, I was wondering what is generally done when a D3D progam is minimized?
Evil Steve
Evil Steve
Quote:
Original post by bjle
Placing my BeginScene() through my Present() in an if(isWindowVisible) gets rid of the screetching noise, but not the cpu usage. Putting a Sleep(1) in my main loop worked, but that just doesn't seem "elegant."

So, I was wondering what is generally done when a D3D progam is minimized?
Yup, that's what I do too. Calling Present() when the window isn't visible does strange things - I think the gfx card is going at a stupid speed, because it has no slowdown from blitting to the window.
The Sleep() call is good, but you might want ot change it to Sleep(250) or something, just to give the user pretty much all of their CPU back. a quarter of a second delay (at most) when restoring the window isn't going to upset anyone.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.