20,741
edits
m (→Image Sharing) |
|||
Line 760: | Line 760: | ||
* ImageStream is updated by a background thread. The xine-lib and QuickTime plugins both subclass from ImageStream and OpenThreads::Thread to provide a class thatautomatically runs updates on itself - this thread updates the image data on the ImageStream and then calls dirty to tell the rendering thread that it needs to download the data to any associated texture.<ref>https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg11405.html</ref> | * ImageStream is updated by a background thread. The xine-lib and QuickTime plugins both subclass from ImageStream and OpenThreads::Thread to provide a class thatautomatically runs updates on itself - this thread updates the image data on the ImageStream and then calls dirty to tell the rendering thread that it needs to download the data to any associated texture.<ref>https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg11405.html</ref> | ||
* It's better to update the data stored in the Image directly and call dirty, or to allocate the image memory separately and disable the deletion of the data on the image so the osg::Image(Stream) never calls delete on the data.<ref>https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg11440.html</ref> | * It's better to update the data stored in the Image directly and call dirty, or to allocate the image memory separately and disable the deletion of the data on the image so the osg::Image(Stream) never calls delete on the data.<ref>https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg11440.html</ref> | ||
=== Offscreen rendering === | |||
The two options for off screen rendering are a PixelBuffer context or | |||
FrameBufferObject, if you have an existing on screen window in your | |||
application then using a FrameBufferObject becomes preferable. The | |||
way to do it would be to set up your viewer's off screen Camera with | |||
FBO settings and a custom final draw callback to do the read to main | |||
memory. The read will be more efficient if you use a pair of | |||
PixelBufferObjects - the osgscreencapture example illustrates this in | |||
action. | |||
As you are already using CompositeViewer the most natural thing to do | |||
would be to have a dedicated View with it's master Camera as the | |||
offscreen camera, this way you can control the Camera's view matrix in | |||
straight forward manner in the same way to the rest of the Camera's. | |||
Also during debugging having the option of making this Camera an | |||
onscreen one would give you means to visually QA things as you go | |||
along. <ref>https://groups.google.com/g/osg-users/c/WTkiQNLE3ek/m/6eB3Z7MoEgAJ</ref> | |||
=== Multiple Viewers === | === Multiple Viewers === |