From 7fb88a83ffe6641772d7d3358baf81922199ebd0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 6 Nov 2009 18:06:16 +0000 Subject: [PATCH] Added remapping of internal texture formats to GL_RGBA etc when just the number of components is used i.e. 1 -> GL_ALPHA, 2 -> GL_LUMINANCE_ALPHA 3 -> GL_RGB 4 -> GL_RGBA --- src/osg/Texture.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 7b0406683..22e234156 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1397,6 +1397,13 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const } _internalFormat = internalFormat; + + // GLES doesn't cope with internal formats of 1,2,3 and 4 so map them to the appropriate equivilants. + if (_internalFormat==1) _internalFormat = GL_ALPHA; + if (_internalFormat==2) _internalFormat = GL_LUMINANCE_ALPHA; + if (_internalFormat==3) _internalFormat = GL_RGB; + if (_internalFormat==4) _internalFormat = GL_RGBA; + computeInternalFormatType(); //osg::notify(osg::NOTICE)<<"Internal format="<