[osg-users] Read FBO with PBO

2017-07-07 Thread Cary, Karl A.
I have a unique situation where I have to render my full scene to the screen, 
but then also render a separate subset out to a shared memory segment. This was 
achieved by creating a second camera, attaching the needed subset, rendering to 
an FBO with a texture applied, and then doing a readImageFromCurrentTexture in 
the final draw callback. This all works. The resultant data is then memcpy'd to 
the location in shared memory that it needs to go (unfortunately I can't change 
that requirement at all, the target is raw data at the location). Alternatively 
I also tried applying the image directly to the fbo rather than a texture, and 
it was slightly faster, but still very slow. To test that this method will 
ultimately work, if I attach the texture but then only do the 
readImageFromCurrentTexture if I signal it, via keyboard input, the scene 
continues to render to the FBO and the last scene copied from the texture will 
be continually sent to the shared memory segment. The performanc
 e of this is what we are looking for, we just have the one frame hit every 
time I signal it. All this really does is prove that if I can speed up the 
read, this solution will work.

The issue I have is the readImageFromCurrentTexture is extremely slow, about 20 
ms. My initial thought was to use a pixel buffer object just like in the 
osgscreencapture example, which we have done before for applying some post 
processing effects with the data from the backbuffer with great success. The 
problem is, I can't figure out how to bind to the frame buffer object. In raw 
GL, you bind to GL_COLOR_ATTACHMENT0_EXT. That fails and gives a State::apply 
error and results in simply reading the back buffer instead. I have tried all 
of the COLOR_ATTACHMENT buffers and they all give me the same result.

Is it possible to bind just to the texture and do a glTexSubImage2D instead of 
a glReadPixels? If so, how do I actually get that set up? I have attempted to 
do it the same way I bind the texture for doing the readImageFromCurrentTexture 
but that does not work either.


smime.p7s
Description: S/MIME cryptographic signature
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Wait for Database pager to complete

2017-07-07 Thread Robert Osfield
HI Bruno,

Make sure you are using ref_ptr<> in your ReadFileCallback for any
scene graph data structures so if you remove nodes from the main scene
graph they don't get deleted mid load.  If you do this properly then
there should be no need to mess around with blocks that would
complicate the code.

Robert.

On 7 July 2017 at 14:46, Bruno Oliveira  wrote:
> Hello,
>
> i have a PagedLOD bases scene.
>
> At some point I remove a node, but OSG sometimes is reading a subnode and
> crashes at ReadFileCallback.
>
> I can solve this if there is some mechanism to wait for the current callback
> to finish reading, like for instance a
> osgDB::DataBasePager::waitForCurrentThreadToFinish() function.
>
> Is there something like this?
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Wait for Database pager to complete

2017-07-07 Thread Bruno Oliveira
Hello,

i have a PagedLOD bases scene.

At some point I remove a node, but OSG sometimes is reading a subnode and
crashes at ReadFileCallback.

I can solve this if there is some mechanism to wait for the current
callback to finish reading, like for instance a
osgDB::DataBasePager::waitForCurrentThreadToFinish() function.

Is there something like this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org