Hi, I have an osg::Drawable with a drawImplementation that uses texture unit zero. I have tried using the code below on the stateset of my drawable to disable all other texture units. Unexpectedly I find the texture unit which is enabled to be the last one I disabled with stateset->setTextureMode(). Is there anyway to set up the stateset so texture unit 0 is guaranteed to be the active texture unit when my draw implementation gets called, or is there something I am missing?
Thanks, Brad -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: Tuesday, December 20, 2005 11:49 AM To: osg users Subject: Re: [osg-users] enabling/disabling textures The StateSet manipulator works just fine for toggleing textures off, and then back on. The code is: unsigned int mode = osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF; if ( _texture ) mode = osg::StateAttribute::INHERIT|osg::StateAttribute::ON; for( unsigned int ii=0; ii<_maxNumOfTextureUnits; ii++ ) { _drawState->setTextureMode( ii, GL_TEXTURE_1D, mode ); _drawState->setTextureMode( ii, GL_TEXTURE_2D, mode ); _drawState->setTextureMode( ii, GL_TEXTURE_3D, mode ); _drawState->setTextureMode( ii, GL_TEXTURE_RECTANGLE, mode ); _drawState->setTextureMode( ii, GL_TEXTURE_CUBE_MAP, mode); } On 12/20/05, Matthias Ferch <[EMAIL PROTECTED]> wrote: > i want to make three rendering modes available for my users - wireframe, > solid geometry and textured geometry. for the first 2 ones i disable > textures like this: > > SceneView->getLocalStateSet()->setTextureMode( 0, GL_TEXTURE_1D, > osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF ); > SceneView->getLocalStateSet()->setTextureMode( 0, GL_TEXTURE_2D, > osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF ); > SceneView->getLocalStateSet()->setTextureMode( 0, GL_TEXTURE_3D, > osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF ); > > but when i turn them on again, nothing happens.. have i misunderstood > something? thx :) > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
