Let me phrase my question better...
How do I associate a Texture2DArray defined in my stateset with a particular
Uniform so that it can be accessible in the shader? For regular textures, this
would be done using the Texture Unit number.
Also, is it valid to have a Texture2DArray defined as having a texture format
of GL_LUMINANCE_ALPHA32F_ARB?
I've defined my texture array like this:
Code:
osg::Texture2DArray *textureArray = new osg::Texture2DArray();
textureArray->setTextureSize(0, 0, depth);
textureArray->setInternalFormatMode(osg::Texture2DArray::USE_IMAGE_DATA_FORMAT);
textureArray->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR_MIPMAP_LINEAR);
textureArray->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
textureArray->setUseHardwareMipMapGeneration(true);
for (int i = 0; i<depth; i++)
{
char filenameStr[1040];
snprintf(filenameStr, 1040, "/%06d.tiff", i);
std::string filename = directory + filenameStr;
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(filename);
image->setInternalTextureFormat(GL_LUMINANCE_ALPHA32F_ARB);
textureArray->setImage(i, image.get());
}
geode->addDrawable(polyGeom);
polyGeom->getOrCreateStateSet()->setTextureAttribute(TEX_ARRAY_ID,
textureArray, osg::StateAttribute::ON);
osg::ref_ptr<osg::Uniform> TextureArrayUniform =
new osg::Uniform(osg::Uniform::SAMPLER_2D_ARRAY, "textureArray",
TEX_ARRAY_ID);
geode->getOrCreateStateSet()->addUniform(TextureArrayUniform.get());
And I'm getting this OpenGL error when compiling my TextureArray:
> Warning: detected OpenGL error 'invalid enumerant' at
> StateSet::compileGLObejcts() compiling texture attribute.
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43018#43018
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org