[osg-users] Problem setting a skydome
david.spilling at gmail.com
Wed Jul 16 12:41:49 PDT 2008
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.
> osg::ClearNode* clearNode = new osg::ClearNode;
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.
osg::TexEnv* te = new osg::TexEnv;
> stateset->setTextureAttributeAndModes(0, te, osg::StateAttribute::ON);
Slightly surprised to see this, but if your skydome needs it, then OK.
> stateset->setMode( GL_CULL_FACE, osg::StateAttribute::ON );
> osg::Depth* depth = new osg::Depth;
> 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
I looked at my code and noticed that I also do
camera->setCullingMode(osg::CullSettings::NO_CULLING), but can't remember at
the moment whether it's relevant.
Lastly, what OSG version are you using?
Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users