Hi all, and thanks in advance for any interest to this post.

I'm trying to build an application with multiple views and an overlay GUI. 

I dediced to use the CompositeViewer to allow different scenes and manipulators 
in each background views. Unfortunately, I don't manage to make the foreground 
view transparent. It always hide the background views. Is it only a 
configuration issue (camera, graphical context ?), or is it something that 
Views can't do ?

Here is my code for now :

Code:

osgViewer::CompositeViewer * compositeViewer = new osgViewer::CompositeViewer();

// Initialize the graphic context
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
osg::GraphicsContext::Traits;
traits->x = 100;
traits->y = 100;
traits->width = 300;
traits->height = 300;
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> gc = 
osg::GraphicsContext::createGraphicsContext(traits.get());

// Build background view
osgViewer::Viewer * backgroundView = new osgViewer::Viewer();
backgroundView->getCamera()->setGraphicsContext(gc.get());
backgroundView->getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, 
traits->height));
compositeViewer->addView( backgroundView );

// Fill background view
osg::ref_ptr<osg::Node> backgroundNode = osgDB::readNodeFile(pathToScene);
backgroundView->setSceneData(backgroundNode);

// Build foreground view
osgViewer::Viewer * foregroundView = new osgViewer::Viewer();
foregroundView->getCamera()->setGraphicsContext(gc.get());
foregroundView->getCamera()->setViewport(new osg::Viewport(traits->width/2, 0, 
traits->width/2, traits->height/2));
compositeViewer->addView( foregroundView );

// Try to set it transparent
foregroundView->getCamera()->setClearColor(osg::Vec4(0, 0, 0, 0));

// Fill foreground view
osg::ref_ptr<osg::Node> foregroundNode = osgDB::readNodeFile(pathToScene);
foregroundView->setSceneData(foregroundNode);

// Run the composite viewer
compositeViewer->run();




The foregroundView is indeed set to black, but is not transparent at all.

Thank you for any help !
Stephane[/code]

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to