Hi All,

when usign a Texture2DArray I face a strange issue.
Loading images coming from png or jpg file format, everything works fine.
When I load the same images from other formats, like dds, tga or tif, I get
a GL warning
Warning: detected OpenGL error 'set img idx invalid enumerant0' after
RenderBin::draw(,)

and no texture shows up.

In particular I'm interested in loading DDS compressed file.
I saw that a patch for loading compressed DDS images to texture array has
been merged already, so I can't understand where the problems lies.
Any setting in the texture/image might help?

Below is the relevant code, and in attachment you find the whole file I used
as an example.

I'm on win, osg 2.8.2

Thank you,
Ricky


   osg::ref_ptr<osg::Texture2DArray> pTextureArray = new
osg::Texture2DArray;
   pTextureArray->setTextureDepth(imgFileNameVec.size());

   // tried both with false and true, same results
   pTextureArray->setUseHardwareMipMapGeneration(false);

   for (unsigned int i = 0; i < imgFileNameVec.size(); ++i)
   {
      // NOTE textures in the array must be same size and format.
      // apparently there's an issue with images coming from some formats
      osg::Image* pImg = osgDB::readImageFile(imgFileNameVec[i]);
      if (pImg)
      {
         pTextureArray->setImage(i, pImg);
         std::cout << "added image " << pImg->getFileName() << " to
texArray." << std::endl;
      }
      else
         osg::notify( osg::ALWAYS ) << "Can't open image: " <<
imgFileNameVec[i] << std::endl;
   }

   // must specify a filter
   pTextureArray->setFilter( osg::Texture2DArray::MIN_FILTER,
osg::Texture2DArray::LINEAR);
   pTextureArray->setFilter( osg::Texture2DArray::MAG_FILTER,
osg::Texture2DArray::LINEAR);
   // set attribute
   pSS->setTextureAttribute(0, pTextureArray.get(),
osg::StateAttribute::ON);

Attachment: TextureArrayAnimation.cpp
Description: Binary data

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to