Hi Christian, You are probably coming up against the problem of the osgProducer::Viewer using camera manipulators to set the view matrix on each frame, this overwrites the Producer setting.
One thing you could try is to use osgProducer::Viewer::setViewByMatrix(..); and pass in a Matrix set up as look at. If you are new to the OSG and just starting out, then I'd recommend using the osgViewer library found in the 1.9.x and SVN versions of the OSG. Integration with core OSG is much cleaner in osgViewer than it is with osgProducer. Robert. On 6/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello, I have a question about how to set the position of a camera. I do it the following way: Producer::CameraConfig* createCameraConfig(void) { // create a new render surface Producer::RenderSurface *rsWindow = new Producer::RenderSurface; // set the number of screens rsWindow->setScreenNum(0); // set the window title bar caption rsWindow->setWindowName("CameraTest"); // set the window client size rsWindow->setWindowRectangle(0,0, 1024, 768); // create a new camera Producer::Camera *camera = new Producer::Camera; // set the render surface of the camera to the window that was just created camera->setRenderSurface(rsWindow); // set the size of the camera viewport to the same size as the window camera->setProjectionRectangle(0,0,1024,768; // set the camera position camera->setViewByLookat(Producer::Vec3(0.0f,0.0f,-6.0f), Producer::Vec3(0.0f,0.0f,0.0f), Producer::Vec3(0.0f,1.0f,0.0f)); // create a new camera configuration container Producer::CameraConfig *cfg = new Producer::CameraConfig; // add the camera that was just created to the configuration cfg->addCamera("Camera One",camera1); return(cfg); } void createView() { // Create View with ProducerCamera Config m_viewer = new osgProducer::Viewer(createCameraConfig()); // Create Scene root m_viewerRoot= new osg::Group(); m_viewerRoot->setName("Root"); // Sett default Settings m_viewer->setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); /* Test to check position set up on View m_viewer->setViewByLookat(Producer::Vec3(0.0f, 0.0f,-10.0f), Producer::Vec3(0.0f, 0.0f, 0.0f), Producer::Vec3(0.0f, 1.0f, 0.0f)); */ m_viewer->setSceneData(m_viewerRoot.get()); m_viewer->realize(); } I can set the position with setViewByLookat() to whatever I want, but nothing changes to the initial camera position. It is always the default position or something unspecific. Because Producer::Camera is an external component which is used by the osgProducerViewer i tried to set the position directly on the viewer by: setViewByLookat() But this has no effect too. If i call later in the code const double* pos = m_viewer->getPosition(); i got always some position values i've never set ... Is there a way to predefine the Producer::Camera or Viewer Position? Thanks for any help. Best regards Christian _______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/