Hi Robert,

thanks for the input!
When thinking about this, I really want to find another approach than the "main 
loop" because I need to execute the CUDA code at a very specific point in time. 
(After a RTT Camera Texture has been written, but prior to rendering another 
texture).

Therefore, I think I cannot use a camera postDrawCallback, because that doesnt 
solve the problem of displaying the CUDA output after it has been produced in 
the same frame.

My idea was to create a "fake" drawable node and use a DrawCallback together 
with renderBins to make my custom CUDA code execute at a very specific time 
during rendering traversal.

However, I'm having trouble getting that approach to work. If I create a very 
simple scene graph, only consisting of a root node and 10 of my custom drawable 
nodes attached to it, each with another render bin number, the execution order 
of my drawCallbacks does not follow the renderbin number. Instead, the 
drawCallbacks always execute in the same order that I have added the drawables 
to the root node.

Does anyone know why that happens? From my understanding, the renderbin number 
should determine the order of draw (and therefore also of the drawCallback?) 
operations.


robertosfield wrote:
> Hi Philipp
> 
> On 15 June 2016 at 14:48, Philipp Meyer <> wrote:
> 
> > figured it out.
> > One needs to use
> > 
> > 
> > Code:
> > viewer->setReleaseContextAtEndOfFrameHint(false);
> > 
> > 
> > 
> > to prevent the context from getting released after a frame is rendered.
> > That way, its resources, like textures, can still be accessed after the 
> > frame completes.
> > 
> 
> I don't have CUDA experience so can't comment on this specifically.
> 
> On the OSG side the setReleaseContextAtEndOfFrameHint() is only useful
> in when you have a single graphics context and are running your
> application SingleThreaded.
> 
> There will be other ways to integrate CUDA rather than via the main
> loop.  You should be able to create a custom GraphicsOperation and
> attach this to a GraphicsWidnow or Camera draw callback to invoke the
> CUDA side from within a thread that has the graphics context current.
> 
> Robert.
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67782#67782





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to