[osg-users] OSG and NVX_gpu_memory_info

Garth D garthy_gso at entropicsoftware.com
Tue Sep 29 19:49:27 PDT 2015


Hi all,

I was wondering if anyone has been successful in using the 
NVX_gpu_memory_info extension with OpenSceneGraph, and the best place to 
call glGetIntegerv to get the associated values.

Details on the extension here: 
https://www.opengl.org/registry/specs/NVX/gpu_memory_info.txt

I'm using Linux, OSG 3.2.1, and a card that supports the 
NVX_gpu_memory_info extension.

I have tried querying the current and total memory using 
GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX and 
GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, and in each case but one, 
the values reported back are zero.

The only success I have had thus far has been querying the values via an 
osg::Operation set with ViewerBase::setRealizeOperation() on my viewer 
(osg::Viewer). The values returned appear to be correct. This allows me 
to get the correct values *once* at the start of the program. 
Unfortunately I need to query them periodically, and I have been unable 
to do this.

So far, I have tried hooking the calls into:
- An osg::Camera::DrawHandler, set via 
osg::Camera::setInitialDrawCallback().
- An osg::Node::NodeHandler, hooked into the root node via 
osg::Node::setUpdateCallback.
- An osg::Drawable::DrawCallback, hooked into a dummy chain off the root 
of: osg::Node -> osg::Geode -> osg::Geometry (osg::Drawable), via 
osg::Drawable::setDrawCallback.
- An osg::Drawable::CullCallback , hooked into a dummy chain off the 
root of: osg::Node -> osg::Geode -> osg::Geometry (osg::Drawable), via 
osg::Drawable::setCullCallback.
- An osg::Camera::DrawHandler, set via 
osg::Camera::setFinalDrawCallback(). Only partly-tested due to a 
race-condition that occurs in my code, but appears to fail.

I have experimented with osg::GraphicsContext::makeCurrent() with each.

Can anyone suggest a better place to hook these calls into? Or 
alternatively confirm that they have the extension working with one of 
the above, so I can change or experiment with my existing setup to try 
to make it work?

Cheers,
Garth



More information about the osg-users mailing list