[osg-users] OSG and NVX_gpu_memory_info

Garth D garthy_gso at entropicsoftware.com
Wed Sep 30 17:42:01 PDT 2015


Hi Robert,

On 30/09/15 19:50, Robert Osfield wrote:> If you want to check 
periodically then just use a Camera::DrawCallback
 > attached to the main camera attached to the GraphicsContext/Window of
 > interest.  This will be called every frame, but within this callback you
 > could have your own check to see if the GL calls are required for that
 > frame.

I've put together a test application that tries out a bunch of simple 
configurations based on the exact setup you describe. The calls worked 
correctly and consistently with either an Operation (or 
GraphicsOperation) attached with setRealizeOperation(), or a 
Camera::DrawCallback attached with setInitialDrawCallback(), or both.

If I had to guess, I am doing something in my project at some point 
after the setRealizeOperation operation is called that causes it to fail 
by the time it gets around to the first call to the callback set by 
setInitialDrawCallback() in the Camera.

Many thanks for pointing me in the right direction. Both techniques you 
mention work perfectly in the simple test application. The actual issue 
must be something I am doing differently between the minimal example and 
the full project. I'll have to experiment with the two to figure out 
what the difference is.

Cheers,
Garth

 > On 30 September 2015 at 10:56, Garth D <garthy_gso at entropicsoftware.com>
> wrote:
>
>>
>> Hi Robert,
>>
>> Thanks for having a look at things and for the suggestion.
>>
>> On 30/09/15 17:35, Robert Osfield wrote:> HI Garth,
>>> I'd use a RealizerOperation.  Have a look at the osgvolume example to an
>>> example of using a RealizerOperation to get information from the graphics
>>> context.
>>
>> I was unfortunately unable to solve the problem. Here is what I tried:
>>
>> I checked the osgvolume.cpp source for 3.2.1 and 3.4.0, but did not find a
>> RealizerOperation in either.
>>
>> I did notice that osgvolume does also use viewer.setRealizeOperation() for
>> TestSupportOperation, defined earlier. Is this what you are referring to?
>> Assuming yes: This is the way I was able to successfully query the
>> information once only at the start of the program. Unfortunately I need to
>> query the information periodically, ie. over the course of the program,
>> rather than just at initialisation. Unless I am mistaken, the target of
>> setRealizeOperation is only called the one time, on viewer realization. Is
>> this right? If so: Is there a corresponding call that I can use to attach
>> an osg::Operation or similar to in order to make the required calls
>> periodically? If not: Is there a way to indicate that the operation should
>> be repeatedly called?
>>
>> Or is there another part of osgvolume.cpp that I should be looking at? The
>> only glGet* call in the file is in TestSupportOperation, which is set using
>> setRealizeOperation(), so I think I am looking in the right place?
>>
>> I'll continue to experiment. Thanks again for the suggestion. Is there
>> anything else I should try?
>>
>> Cheers,
>> Garth
>>
>>
>>>
>>> Robert.
>>>
>>> On 30 September 2015 at 03:49, Garth D <garthy_gso at entropicsoftware.com>
>>> wrote:
>>>
>>>> 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
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> osg-users at lists.openscenegraph.org
>>>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>




More information about the osg-users mailing list