Hi Vic, The view's Camera's Color value will be taking precedence over that of the graphics window, so typically you'll just set the camera's colour and not worry about the GraphicsWindow. Since the viewers cameras normally cover the whole window GraphicsWindow even defaults to not clearing (the GraphicsContext::ClearMask is set to 0 by default) so it doesn't waste any time.
If your camera's don't cover the whole window then you simple set the clear mask on window to the appropriate value (typically just GL_COLOR_BUFFER_BIT). The active Camera will also write over the top of this though. Robert. On Fri, Jul 24, 2009 at 4:33 PM, Vic Ace<typedefinit...@gmail.com> wrote: > I have been looking at this example > (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgcompositeviewer/osgcompositeviewer.cpp) > and written code similar to the parts that I think are relevant but all I > get inside my window is a plain black background. I have set it to display a > blue background and given it a capsule to render but none of that is > displayed. Have I missed something really obvious? > > > Code: > osg::ref_ptr<osgViewer::CompositeViewer> viewer = new > osgViewer::CompositeViewer; > > osg::ref_ptr<osg::GraphicsContext::Traits> traits = new > osg::GraphicsContext::Traits; > traits->x = 100; > traits->y = 100; > traits->width = 800; > traits->height = 600; > traits->depth = 16; > traits->windowDecoration = true; > traits->supportsResize = false; > traits->windowName = "TEST"; > > osg::ref_ptr<osg::GraphicsContext> graphicscontext = > osg::GraphicsContext::createGraphicsContext(traits); > > if (graphicscontext.valid()) > { > graphicscontext->setClearColor(osg::Vec4f(0.2f, 0.2f, 0.6f, 1.0f)); > graphicscontext->setClearMask(GL_COLOR_BUFFER_BIT | > GL_DEPTH_BUFFER_BIT); > } > > osg::ref_ptr<osg::Group> root = new osg::Group(); > osg::ref_ptr<osg::Geode> geode = new osg::Geode; > osg::ref_ptr<osg::Capsule> capsule = new osg::Capsule(osg::Vec3(), 1, 2); > osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(capsule); > geode->addDrawable(drawable); > root->addChild(geode); > > osg::ref_ptr<osgViewer::View> view = new osgViewer::View; > viewer->addView(view); > view->setSceneData(root); > view->getCamera()->setGraphicsContext(graphicscontext); > > viewer->run(); > > > > Thanks! > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=15397#15397 > > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org