cpu load

Hi,
I have an application with several stay-on-top windows and one opengl window which lies under them. When size of opengl window is large or/and many stay-on-top windows are opened the application uses 100% cpu time when opengl is rerendered. However when clossing one of stay-on-top windows or making opengl window a little bit smaller application takes no more than 3% precent of cpu load. What can be a reason fo such a sudden increase in cpu load?? How can I solve this problem??

Thanks in advance.

filip

Is this a guess how I code question?

I’m guessing you are rendering in a infinite loop. I’m guessing v-sync is enabled.
I’m guessing you aren’t rendering much.
So cpu load is near 0%

When the window gets covered or even partially covered, v-sync doesn’t work anymore and cpu usage goes to 100%

To solve, measure FPS. If too high, call Sleep with a appropriate time. I did this by starting with 1ms, then I increment/decrement until I reach my target FPS.

Thanks for your answer. Sorry for not giving enough information. I can not post my code here because i am redesigning it now but I will try to give more details in this post. Rendered scene is in fact not very complicated it consists of five polygons and one sphere. In my application rendering is done on mouse move (on borland’s OnMouseMove event). One of the objects is following mouse and translation vector for it is calculated using gluUnProject(…). Even in maximum opengl window size (which is almost 1280x1024) it is rendered smoothly with fast mouse moves and cpu load is about 3%. What is amazing for me is that when I open stay-on-top windows (placed with SetWindowPos(Handle,HWND_TOPMOST,…)) cpu load reaches 100% when moving object fast and object does not fallow mouse smoothly. Strange thing for me is that it depends on number of stay-ontop windows (for example for 2 windows application works fine and after opening third one the problem apears)and size of opengl window (the smaller this window is the more it can be covered with stay-on-top windows).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.