Where can I find an example on how to use a TextureArray with OSG?

I'm trying to setup a uniform to send this TextureArray to my fragment shader 
and I'm confused on how to do this. Usually, you'd send a texture to the shader 
by setting the texture uniform to the texture number so I thought I would need 
to do this for a TextureArray:
   geometry->getOrCreateStateSet()->setTextureAttribute(BASE_TEX_ID, 
textureArray, osg::StateAttribute::ON);

   sset->addUniform(
        new osg::Uniform(osg::Uniform::SAMPLER_2D_ARRAY, "textureArray", 
BASE_TEX_ID));

However, when I assign BASE_TEX_ID to 0, I'm getting:
"Uniform numElements < 1 is invalid"

from this call:
Uniform::Uniform( Type type, const std::string& name, int numElements ) :

This seems to imply that the third argument to the Uniform constructor isn't 
the texture number but the TextureArray size (?).   Then how do you set this 
TextureArray to a particular texture number? 

I'm confused...  Is there an example out there that shows how to use a 
TextureArray?

Paul P.

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to