In general, you do not. OpenGL is ultimately a hardware abstraction. And OpenGL just doesn't provide a way to get such information.
There are extensions for suppliers that will give you the opportunity to ask, although what you get depends on the architecture. AMD hardware provides the ATI_meminfo extension. It breaks the memory into types of objects: buffer objects, textures, and rendering buffers.
NVIDIA provides the experimental extension NVX_gpu_memory_info. There is no information in the registry on how to use it, so I canβt connect you with anything.
In any case, the most effective way to find out what the GPU is using is to simply track it yourself. Always use internal image formats with dimensions ; this means that you can calculate a pretty good estimate of how much memory the texture takes. The same applies to buffer objects, etc.
You will not get exact numbers, as indentation, alignment, etc. may confuse you. But you get something pretty decent.
Nicol bolas
source share