Dear all,

I want to combine a movie (movie shot by a camera) with some OSG 3D objects. I 
already managed to make sure that the position and orientation of the camera 
are stored each time a picture is grabbed (as part of the movie). The sequence 
of the movie is stored in memory (can choose between RGB24 and RGB32) in a 
buffer (an array of char* blocks). I just need to call an API function of the 
camera to convert this to an AVI sequence. 

Now before I call this function to convert the contents of the buffer to an AVI 
movie, I want to do the OSG rendering (this is my postprocessing step). 

The technique I use, is:
* Adding an OSG camera to the OSG root node and adding the scene data as a 
child to the OSG camera
* Set the render order as POST_RENDER
* Set the target of the rendering to FRAME_BUFFER_OBJECT
* I explicitly don't set the clear mask for the camera: 
"setClearMask((GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)" is not present in 
the code. I hope this is right ?

This results in the following code:


Code:

m_pSnapshotcamera = new Camera;
m_refpARRoot->addChild( m_pSnapshotcamera );

m_pSnapshotcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
m_pSnapshotcamera->setProjectionMatrixAsPerspective(snapVerFov, 
snapAspect,0.01, 40000);
m_pSnapshotcamera->setDrawBuffer(GL_BACK);
m_pSnapshotcamera->setReadBuffer(GL_BACK);
m_pSnapshotcamera->setRenderOrder(osg::Camera::POST_RENDER);
m_pSnapshotcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);




Now, how do I assign the (AVI sequence) memory as the frame buffer to write to 
? I am aware of the attach() member function of the Camera class, but this 
needs an (OSG) image as a parameter. 

Also, how can I make sure that OSG renders the 3D objects into a window with 
the size of the camera (video) pictures? I clarify: in the code above, I 
already defined the horizontal and vertical field of view (using the aspect 
ratio), but still the system can't deduce what the size of the frame buffer is 
(let's assume that the video is 640 x 480, which is different than the standard 
size of my OSG widgets).

Thank you!

Kind regards,
Benedikt Naessens.[/code]

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





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

Reply via email to