Hi All, as a follow-up I discovered that the limitation seems to depend on the "internalTextureFormat" of the images loaded. I succeded in fixing the TGA settings but not the DDS. Here the setting for the different image types as read from the plugins:
PNG (works fine) _dataType = GL_UNSIGNED_BYTE _pixelFormat = GL_RGBA _internalTextureFormat = GL_RGBA TGA (works fine if intenal pixel format is changes to GL_RGBA) _dataType = GL_UNSIGNED_BYTE _pixelFormat = GL_RGBA _internalTextureFormat = 4 --> set to GL_RGBA works ok DDS (can't make it work) _dataType = GL_UNSIGNED_BYTE _pixelFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT _internalTextureFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT I've tried to change the DDS internal format to GL_COMPRESSED_RGBA, as I read from the doc here: http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml - but it still doesn't work. Any suggestion anybody? Is this the correct area to solve the problem? Thanks, Ricky On Mon, Apr 19, 2010 at 19:21, Riccardo Corsi <[email protected]>wrote: > 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); >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

