Hi Ethan,
All you should need to do is attach your osg::Texture to the osg::Stateset that
you are attaching your osg::Program to and then you also need to add an
osg::Uniform to the Stateset for the texture sampler that you use in your
shader program to access the texture:
Code:
osg::ref_ptr<osg::Geometry> spGeometry = new osg::Geometry();
osg::ref_ptr<osg::Texture2D> spTexture = new osg::Texture2D();
osg::StateSet* pStateSet = sp->getOrCreateStateSet();
pStateSet->setTextureAttributeAndModes(0, spTexture.get(),
osg::StateAttribute::ON);
//bind the sampler to texture unit zero
osg::Uniform* pSampler = new osg::Uniform("TextureSampler", 0);
pStateSet->addUniform(pSampler);
Thank you!
Cheers,
Alex
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45521#45521
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org