Hi
I've used it and iirc it works just ok. I'm not used to slave cameras, but may be you are overwriting your slave camera output with viewer camera (which are without colormask)?
You can check if it work with viewer.getCamera()->setColorMask(...) instead of using slave.
Cheers.
06.09.2012, 15:08, "Angel" <[email protected]>:
Hi everybody,I have a very basic problem and I think I'm doing something wrong or, maybe, there is a bug.I've been looking for older posts but I haven't found the solution to my problem.In the following program I use setColorMask and it doesn't affect the rendering in anyway, am I missing something? what am I doing wrong?//////////////////////////////////////////////////////////#include <stdio.h>#include <osgViewer/Viewer>#include <osgDB/ReadFile>#include <osg/ColorMask>#include <osgViewer/ViewerEventHandlers>#include <osgGA/TrackballManipulator>int main ( int argc, char * argv[] ){osgViewer::Viewer viewer;const std::string filename = "..\\data\\cessna.osg";osg::ref_ptr<osg::Node> model = osgDB::readNodeFile(filename);if ( !model.valid() ) {std::cout << "Could not find: " << filename << std::endl;}viewer.addEventHandler(new osgViewer::StatsHandler);viewer.setCameraManipulator( new osgGA::TrackballManipulator() );// GraphicContextosg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;traits->displayNum = 0;traits->screenNum = 1;traits->x = 10;traits->y = 10;traits->width = 1024;traits->height = 768;traits->windowDecoration = true;traits->doubleBuffer = true;traits->sharedContext = 0;traits->samples = 8;traits->alpha = 8;traits->stencil = 8;osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());// Cameraosg::Camera * camara = new osg::Camera();camara->setGraphicsContext(gc.get());camara->setViewport( new osg::Viewport(0,0, 1024, 768));// ColorMaskosg::ColorMask *color_green = new osg::ColorMask( false, true, false, true);camara->setColorMask(color_green ); //<= DOES NOTHING!!viewer.addSlave(camara);viewer.setSceneData(model.get());viewer.run();return 0;}//////////////////////////////////////////////////////////////////If I set the setColorMask directly to the cessna model it works perfectly but I want to do it in the camera because I use the same model in other cameras (that should not have the colorMask).Thanks in advance for any help you can give me.Angel Rodriguez.Universidad de Valencia.,_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

