views:

216

answers:

2

I need to completely disable texturing in OSG. I tried glDisable(GL_TEXTURE_2D) and also using an osg::stateSet, but some nodes that have textures still render their textures. Is there any way to globally turn off texturing?

A bit of background : I need to produce an object coverage map for a scene, that is, knowing what object produced each visible pixel. I'm rendering each object with a flat color and reading back the color buffer - this is why texturing breaks what I'm trying to do. Any other ideas about how to accomplish this?

A: 

Have you considered posting your question to the OSG mailing list? That would seem like a much more appropriate place to ask.

none
+1  A: 

Did you make sure to set the osg::StateAttribute::OVERRIDE bit when setting the Texture2D attribute? i.e. something like

osg::Texture2D*const tex2D = new osg::Texture2D;
ss->setAttributeAndModes( tex2D, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE );

where ss is a stateset on a node high enough up in your scene graph to encompass all things that might have textures.

Of course if the GL_TEXTURE_2D mode or any Texture2D attributes lower down have the osg::StateAttribute::PROTECTED bit set then the OVERRIDE will be ignored but you might be in a position where you know that's not going to happen.

Troubadour