Hi,

I am trying to do the following:
Create a Group with children attached. One child is video coming from a 
camera/file and the rest are overlays that should be visible on the video. 
Sometimes there is a shader on  the video, depending on the video format (Mono8 
vs Mono16).

I then want to display the video on the screen using a View and while 
displaying, I want to record the displayed video to a buffer of Images. The 
recorded video must show the overlays that were visible at the time of the 
frame.

I have done the following (mostly from example applications, other libs and web 
searches): 
- I have code that set up my root Group with a few nodes added.
- One node is a Group that displays TextureRectangle (video feed from 
camera/file) 
- The other nodes are mostly overlays that I overlay on the video.
- I have a Viewer that is responsible for displaying this tree (video + 
overlays)
All of this is working fine. 

Now to record the displayed video to a buffer of images I do the following 
(Also from examples):
- I have a recorder class that takes the root node, and sets up a Camera for 
this recorder on the root. 
- I then set the setRenderTargetImplementation() to Camera::FRAME_BUFFER_OBJECT
- I then attach an Image as a Camera::BufferComponent and add the root node to 
the children of the camera (Camera::addChild()).
- Lastly I set a DrawCallback object using the setPostDrawCallback() function 
on the camera. 

Now the problem is:
The operator ()(osg::RenderInfo &) functor is never called on my DrawCallback 
object. I have an idea why this is not working (very limited knowledge of OSG): 
If I do not add the root to the camera, but instead add the Camera to the root 
Group (Group::addChild()) it does go into my functor, but all I record is blue 
images. So I need to add the root node to the camera so that it will have the 
Nodes to record, and add the camera to the root node, so that it will get 
updated when the view is drawn. But how do I do this without breaking the app 
due to the obvious circular dependency (I have tried)?

Or is there an alternative way for me to do this?

I have tried adding my DrawCallback object onto the Camera of the View to then 
write the pixels into an image in the functor, but when the size of the View 
changes (due to for example the app gets resized), I do not get the whole image 
anymore in my Image. Thus the reason why I am attempting to create a second 
camera (will this even work??).

Thank you!

Cheers,
Carel

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to