[osg-users] Per-Frame/per context operation

Robert Osfield robert.osfield at gmail.com
Thu Feb 18 06:03:05 PST 2016


Hi Sebastian,

The osg::GraphicsContext has a list of Operations that it runs on each
frame, so just add your Operation to the GraphicsContext via from
(include/osg/GraphicsContext header):

        /** Add operation to end of OperationQueue.*/
        void add(Operation* operation);

This list is run after the Camera's assigned to the GraphicsContext. See
the GraphicsContext::runOperations() method in src/osg/GraphicsContext.cpp.

The other approach is to assign a Camera to the GraphicsContext that has a
subgraph that contains the operations you want to call.  The advantage with
this approach is that the Camera's are all sorted according to their
RenderOrder and RenderNumber, so you can control render order.

Robert



On 18 February 2016 at 11:53, Sebastian Messerschmidt <
sebastian.messerschmidt at gmx.de> wrote:

> Hi,
> I'm using osg::Operation to perform async tasks and
> osg::GraphicsOperations added via setRealizeOperation to perform on-realize
> per context tasks.
> What is the correct usage of osg::GraphicsOperations if I want it to be
> performed once per frame and context? Let's say at the end of the draw.
> My intention is to use the NVX_gpu_memory_info[1] to keep track of memory
> use and eviction, and since it needs a valid context to operate correctly I
> thought the graphicsOperation would be the way to go.
>
> [1]
> https://www.opengl.org/discussion_boards/showthread.php/170429-NVX_gpu_memory_info
>
> Cheers
> Sebastian
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160218/fb364f99/attachment-0003.htm>


More information about the osg-users mailing list