Hi everyone, Is it possible to add a slave camera in an embedded viewer? I am trying to perform "render-to-texture" in multiple cameras simultaneously and everything works fine until I try to add a slave camera on the viewer.
Here is the context (simplified): Code: // Create an X11/EGL display/context ... // Create a viewer viewer = new osgViewer::Viewer(); osg::ref_ptr<osgViewer::GraphicsWindow> graphics_window = viewer->setUpViewerAsEmbeddedInWindow(0, 0, 640, 480); // Create a texture texture = new osg::Texture2D; texture->setTextureSize(640, 480); texture->setInternalFormat(GL_RGBA); texture->setSourceFormat(GL_RGBA); texture->setSourceType(GL_FLOAT); texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE); texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE); // Create a camera camera = new osg::Camera; camera->setViewport(0, 0, texture->getTextureWidth(), texture->getTextureHeight()); camera->setClearColor(osg::Vec4(1.0f, 1.0f, 1.0f, 0.0f)); camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera->setRenderOrder(osg::Camera::PRE_RENDER); camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); // Attach texture to camera camera->attach(osg::Camera::COLOR_BUFFER, texture); // Bind the texture object osg::State &state = *graphics_window->getState(); texture->apply(state); // Load the camera viewer->addSlave(camera->get()); The last call fails with the message: free(): invalid pointer Am I missing something? Thank you! Cheers, Jean ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=63701#63701 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

