Hi Brad, You need to do the debugging at your end. I've looked at the setActiveTextureUnit(int) code and it all looks correct, and its certainly served the OSG well over the years.
Note, that State.apply() can change the current texture unit since it may well have to apply the various texture units correctly. Robert. On 6/15/06, Anderegg, Brad USA <[EMAIL PROTECTED]> wrote:
Hi Again, Thanks for you quick response, unfortunately that still doesn't seem to solve my problem. I can however boil it down to a very specific question. In my drawImplementation I attempt to set the ActiveTexureUnit and it does not appear to change. Below is a small code snippet: state.setActiveTextureUnit(0); state.apply(); std::cout << "Active Tex Unit: " << state.getActiveTextureUnit(); My problem is that with or without the state.apply(), the active texture unit never changes from one. So really my question is, how can I make the active texture unit be zero? Again, thanks for all the help. Brad -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: Thursday, June 15, 2006 1:11 AM To: osg users Subject: Re: [osg-users] enabling/disabling textures HI Brad, On your custom drawable just do: drawable->getOrCreateStateSet()->setTextureMode(0,GL_TEXTURED_2D, osg::StateAttribute::ON); Or drawable->getOrCreateStateSet()->setTextureMode(0,GL_TEXTURED_2D, osg::StateAttribute::ON | osg::StateAttribute::PROTECTED); The later protecting any settings from being overridden from StateSet inherited from above. Robert. On 6/14/06, Anderegg, Brad USA <[EMAIL PROTECTED]> wrote: > 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/ > _______________________________________________ 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/
