开发者

Force OpenGL to keep contents in memory?

开发者 https://www.devze.com 2023-01-02 01:47 出处:网络
I\'m using OpenGL to render polygons. I notice that if I minimize the program then start usin开发者_如何学JAVAg it again, it will be very slow for a few seconds. (I\'m guessing its reuploading my disp

I'm using OpenGL to render polygons. I notice that if I minimize the program then start usin开发者_如何学JAVAg it again, it will be very slow for a few seconds. (I'm guessing its reuploading my display lists to the card). How can I prevent this because it's a bit annoying. I want it to always have the contents.

Thanks


When you minimize a program under Windows, it does the equivalent of SetProcessWorkingSetSize(current_process, -1,-1);. This tells the virtual memory manager that all the memory occupied by that program is eligible for being paged out. The only way I know of to prevent this is to prevent the user from minimizing the program in the first place (e.g., use DeleteMenu to remove the "minimize" item from its system menu).

Note that this isn't a matter of your program's drawing data being removed from the graphics card -- it's a matter of all its data (and quite possibly code) being removed from memory entirely. Of course, if you have enough memory and a lightly enough loaded system, it won't be removed immediately -- it's just marked as being available, so if the system needs memory for something else, it will be (some of) the first to get used.

0

精彩评论

暂无评论...
验证码 换一张
取 消