From 97e4ad473b2078f7c448af7ef776a2cb1d590a80 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 18 Apr 2012 10:16:09 +0000 Subject: [PATCH] Refactored the handling of GLES adaptations of the 1,2,3,4 internal formats and added handling of GL_RGB8_OES and GL_RGBA8_OES. --- src/osg/Texture.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 8742ca305..15ffb09cc 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1432,13 +1432,23 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const } } +#if defined (OSG_GLES1_AVAILABLE) || defined (OSG_GLES2_AVAILABLE) + // GLES doesn't cope with internal formats of 1,2,3 and 4 and glTexImage doesn't + // handle the _OES pixel formats so map them to the appropriate equivilants. + switch(internalFormat) + { + case(1) : internalFormat = GL_LUMINANCE; break; + case(2) : internalFormat = GL_LUMINANCE_ALPHA; break; + case(3) : internalFormat = GL_RGB; break; + case(4) : internalFormat = GL_RGBA; break; + case(GL_RGB8_OES) : internalFormat = GL_RGB; break; + case(GL_RGBA8_OES) : internalFormat = GL_RGBA; break; + default: break; + } +#endif + _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_LUMINANCE; - if (_internalFormat==2) _internalFormat = GL_LUMINANCE_ALPHA; - if (_internalFormat==3) _internalFormat = GL_RGB; - if (_internalFormat==4) _internalFormat = GL_RGBA; computeInternalFormatType();