PDA

View Full Version : Querying remaining available texture memory ?



Jon Mc Jon
08-28-2006, 11:56 PM
Hello
Mixture of knowledge and ignorance (mainly latter) speaking here.

Is there any way to query OpenGL (and hence hopefully the graphics hardware) to find out how much texture storage space is still available ?

Or do you just have to keep declaring textures until you hit some kind of out-of-memory error and then start deleting them ?

Best Regards
Jon

08-29-2006, 12:16 AM
Hi,

No, there's not. And even if you could, the usefulness of such a number would be dubious at best, as it would likely be a combination of video and system ram - textures can exist in both memories, and both are subject to allocation volatility beyond the programmer's purview and direct control.

Your best bet is to get an approximation of the total ram, and plan your allocation strategy accordingly, from the outset.

If you blindly allocate textures with no foreknowledge of, or concern for, the hardware limitations you're dealing with, then you probably deserve what you get, at least in terms of performance. As a general rule, you should always check for errors conditions.

hth

Jon Mc Jon
08-29-2006, 12:54 AM
Heh, true. I was thinking more of tuning a dynamic system as it goes.

Thanks for answer!

Jon