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