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

Video Memory status?

Started by Tree Penguin Apr 18, 2004 at 5:49 PM 4 replies 550+ views
Original Post
Tree Penguin
Tree Penguin
Hi, how can i get the amount of videocard memory available (total), free and used within my program? Thanks in avance. WWW.TREEPENGUIN.TK
snisarenko
snisarenko
This might help

http://www.codesampler.com/oglsrc.htm

Scroll down to "How to Directly Allocate and Use AGP/Video Memory"
Tree Penguin
Tree Penguin
Ok, i quickly read the examples and the extension specification (how i hate reading those boring files, however i like them being straight to the point). Did i miss something or is the only way to get the free amount of memory allocating and see if it returns the OUT_OF_MEMORY and repeat that action with a decreasing amount of memory till the memory is successfully allocated?
Is it really that weird i want to know the amount of free memory that OpenGL has no function or extension to do it?

WWW.TREEPENGUIN.TK
Steve132
Steve132
I don''t claim to know all of the functions, so I guess I could be wrong, but I dont think that there are any fixed function to do that.

What I would do would be to get the graphics vendor type and search that string for powers of 2 to get the total memory possible. (as in "PNY Geforce4 MX440 64mb"). Then, if such a number is not found, use the technique you posted about to find the total.

Then, keep track of all the memory that you use by updating a counter in your texture loading function. Also update that counter to account for the amount of memory that both of your framebuffers are using( assuming double-buffered mode)

When you want to know how much memory you have left, just subtract the counter''s value from the total you found earlier!

If you are careful with your math, then you should have a decently accurate video memory calculator.

Also, if you do a little googlework, you should be able to find command line executables that you can call with ShellExecuteEx to find the amount of AGP memory

I don''t know if I have been helpful or not, but that is what I would do to solve your problem

-good luck!
Tree Penguin
Tree Penguin
The reason i need the function is to be able to exactly determine what amount of memory a certain list needs.

WWW.TREEPENGUIN.TK
Krohm
Krohm
quote:
Original post by Tree Penguin
The reason i need the function is to be able to exactly determine what amount of memory a certain list needs.

Good luck! This is implementation dependant.
Anyway, GL can''t tell you how much memory the vid card got (theorically this is non-meaningful). DirectX has it but it''s not really accurate for me. In my tests it reported some memory less than what actually equipped for some reason.
Previously "Krohm"

Topic Locked

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

Sign in to reply to this topic.