[osg-users] Creating Texture2DArray

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Thu Oct 20 23:50:09 PDT 2016



Hi Bruno,

Are all your textures/images of the same _format_ and _dimension_? (See 
[1] - Overview) This is required for texture arrays. I haven't 
experienced any problems with them in my code so far ..

Cheers
Sebastian


[1] https://www.opengl.org/registry/specs/EXT/texture_array.txt
> Hello,
>
> I'm trying to create a Texture2DArray. My textures are uchar images with
> size (texWidth, 256), single channel. The combination of texture
> internalFormat and pixelFormat with pixelType is not working. I use
> GL_R8UI for internalFormat, GL_RED_INTEGER for pixelFormat and
> GL_UNSIGNED_BYTE for type. This yields the following error when I try to
> render my scene:
>
> /Warning: detected OpenGL error 'invalid enumerant' at after
> RenderBin::draw(..)/
>
> However, if I use GL_LUMINANCE for internalFormat and also GL_LUMINANCE
> for pixelFormat, I get no errors but my textures are not correctly
> sized. WHat formats should I use here?
>
> This is my code:
>
>
>
> osg::ref_ptr<osg::Texture2DArray> texture = new osg::Texture2DArray;
> texture->setFilter(osg::Texture2DArray::MIN_FILTER,
> osg::Texture2DArray::LINEAR);
> texture->setFilter(osg::Texture2DArray::MAG_FILTER,
> osg::Texture2DArray::LINEAR);
> texture->setWrap(osg::Texture2DArray::WRAP_R, osg::Texture2DArray::REPEAT);
>  texture->setInternalFormat(*textureFormat()*);
>
>
> // Add some images as follows:
> for (...) {
>
>  osg::Image* image = new osg::Image;
> image->setImage(texWidth, 256, 1, *textureFormat(), pixelFormat(),
> type(),* dataPtr);
>
> texture->setImage(i, image);
> }
>
>
> I am using:
> textureFormat() = GL_R8UI;
> pixelFormat() = GL_RED_INTEGER;
> type() = GL_UNSIGNED_BYTE
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list