Hi David, El Miércoles 16 Julio 2008ES 21:41:49 David Spilling escribió: > Alberto, > > I presume that your skydome has some sort of camera centred transform over > it (as per osghangglide's example use); your code doesn't show it.
I haven't coded it yet, I wanted to have the near/far issue fixed first. > > osg::ClearNode* clearNode = new osg::ClearNode; > > > > clearNode->setRequiresClear(false); > > This is odd. If your camera is the first thing to draw (implied by > PRE_RENDER) then something needs to be clearing the colour and depth > buffer. In any case, you can use camera's setClearMask method to control > this without needing a clearNode. For example > camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT) clears > everyhing, setClearMask(0) clears nothing. Yes, you are right. > osg::TexEnv* te = new osg::TexEnv; > > > te->setMode(osg::TexEnv::REPLACE); > > stateset->setTextureAttributeAndModes(0, te, osg::StateAttribute::ON); > > Slightly surprised to see this, but if your skydome needs it, then OK. Well, I wanted to display texture real colour, not modified by any lighting calculation. > > stateset->setMode( GL_CULL_FACE, osg::StateAttribute::ON ); > > > > osg::Depth* depth = new osg::Depth; > > depth->setFunction(osg::Depth::ALWAYS); > > depth->setRange(1.0,1.0); > > stateset->setAttributeAndModes(depth, osg::StateAttribute::ON ); > > Again, not wrong (as the depth testing is always passed) but not really > necessary, as you are ensuring that your skydome is drawn first. I would > tend to prevent depth writing with > osg::Depth* depth = new osg::Depth; > depth->setWriteMask(false); // don't bother writing the depth buffer > stateset->setAttributeAndModes(depth, osg::StateAttribute::ON ); > > and also disable depth testing with > stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF) Yes, I have deleted that block. Finally and thanks to your valuable help, I have managed to get it working. Somehow I were mismatching ClearMask with ColorMask when I eliminated the ClearNode. Now I have the pre-render slave camera, which has its own near/far planes and then the real scene is rendered over it: //Paint over the skydome viewer.getCamera()->setClearMask(GL_DEPTH_BUFFER_BIT); //Create the pre-render skydome camera osg::Camera *camara = new osg::Camera; camera->addChild(skydome.get()); camera->setRenderOrder(osg::Camera::PRE_RENDER); camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SceneRoot->addChild(camera); osg::StateSet* stateset = n->getOrCreateStateSet(); osg::TexEnv* te = new osg::TexEnv; te->setMode(osg::TexEnv::REPLACE); stateset->setTextureAttributeAndModes(0, te, osg::StateAttribute::ON); stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); stateset->setMode( GL_CULL_FACE, osg::StateAttribute::ON ); Again, thank you very much for your advice :) Regards, Alberto _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org