Video Memory Management ?

Hi…
I got couple of questions

Does OpenGL do Texture Memory Management ?
What happens if user calls glTexImage2D() while there is not enough video memory for the action ?

Also, where does OpenGL allocate memory for glTexImage2D()? how to tell if the texture stored in System RAM or Video RAM ?

How to check available Video Memory through OpenGL ?

Thanks…

OpenGL hides this information from you. There are few points where you can take control:
1)texture proxies. You can ask the driver if it can accomodate another texture of a certain size and properties. If it can’t, texture memory is full.
But you can’t query remaining memory, nope.

2)glPrioritizeTextures (look it up in the PDF) - let’s you assign priorities to the texture objects you deem most critical. IMHO no comsumer graphics vendor ever filled this entry point with life, using it would be most certainly a waste of time.

3)glAreTexturesResident - tells you whether the texture data is currently in local memory or not. Suffers the same fate as 2. In addition, even if it works, besides statistics the information is useless anyway.


OpenGL does manage textures itself. With AGP cards, there should be plenty of space left to throw textures at a driver without causing errors.

What this all boils down to, is the old question “will it run fast enough”. Let the user decide. Throw some adjustable settings into your program and you’re set.

Don’t try to come up with an automatic detection scheme, they’ve historically all failed (anyone remember Dungeon Siege?).