Hello, I am trying to use a slave camera in my viewer to follow a node and render what it sees to a pixel buffer, then I convert the images to cv::Mat to do image processing on them. It is a simulation of a robot setup were the camera is rigidly attached to the robot. I have managed to get it mostly working using advice from the forum and the osgscreencapture example but am stuck on a strange little thing. I gather that I need to manually update the _viewOffset of the slave each frame so that it can move around with the robot.
Code: std::int64_t M_OSG_viewer::Draw(void) { _last_draw_time_us = _last_draw_timer.Get_elapsed_us(); if(_has_slave_cam) { osg::View::getSlave(0)._viewOffset = osgViewer::Viewer::getCamera()->getInverseViewMatrix() *_slave_cam_xform->getMatrix() *osg::Matrix::rotate( -osg::PI/2.0, 1.0, 0.0, 0.0 ); } if(_last_draw_time_us > 8333) { osgViewer::Viewer::getViewerBase()->frame(); _last_draw_timer.Restart(); } return _last_draw_time_us; } When I do this it does work but if I use the mouse to manipulate the view of the scene it will move/shift the images from the PBO a bit, that is, it will not stay still. Does anyone know why this would be, is it just round off error? Is there a better approach? Thanks, Patrick ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58615#58615 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org