[osg-users] How to use more than 4 texture units?

Jannik Heller scrawl at baseoftrash.de
Wed Jun 17 10:47:54 PDT 2015


Oops, posted wrong code - that should have been 4 instead of 3, of course.


Code:

diff --git a/examples/osgbillboard/osgbillboard.cpp b/examples/osgbillboard/osgbillboard.cpp
index a6243e8..64f893c 100644
--- a/examples/osgbillboard/osgbillboard.cpp
+++ b/examples/osgbillboard/osgbillboard.cpp
@@ -67,7 +67,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
     (*tcoords)[1].set(1.0f,0.0f);
     (*tcoords)[2].set(1.0f,1.0f);
     (*tcoords)[3].set(0.0f,1.0f);
-    geom->setTexCoordArray(0,tcoords);
+    geom->setTexCoordArray(4,tcoords);
 
     geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
 
@@ -76,7 +76,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
         osg::StateSet* stateset = new osg::StateSet;
         osg::Texture2D* texture = new osg::Texture2D;
         texture->setImage(image);
-        stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
+        stateset->setTextureAttributeAndModes(4,texture,osg::StateAttribute::ON);
         geom->setStateSet(stateset);
     }
 




------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64112#64112








More information about the osg-users mailing list