diff --git a/include/osg/Image b/include/osg/Image index 2c9cb3655..6e252cb2c 100644 --- a/include/osg/Image +++ b/include/osg/Image @@ -92,6 +92,10 @@ #define GL_UNPACK_IMAGE_HEIGHT 0x806E #endif +#ifndef GL_OES_compressed_ETC1_RGB8_texture + #define GL_ETC1_RGB8_OES 0x8D64 +#endif + namespace osg { // forward declare @@ -396,6 +400,9 @@ class OSG_EXPORT Image : public BufferData return _data+getMipmapOffset(mipmapLevel); } + /** returns false for texture formats that do not support texture subloading */ + bool supportsTextureSubloading() const; + /** Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized). */ virtual bool isImageTranslucent() const; diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 3994a016e..164b4fceb 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -1431,6 +1431,17 @@ void Image::ensureValidSizeForTexturing(GLint maxTextureSize) } } +bool Image::supportsTextureSubloading() const +{ + switch(_internalTextureFormat) + { + case GL_ETC1_RGB8_OES: + return false; + default: + return true; + } +} + template bool _findLowerAlphaValueInRow(unsigned int num, T* data,T value, unsigned int delta) diff --git a/src/osg/Texture2D.cpp b/src/osg/Texture2D.cpp index 09ce2b556..0c9e1ac92 100644 --- a/src/osg/Texture2D.cpp +++ b/src/osg/Texture2D.cpp @@ -247,7 +247,7 @@ void Texture2D::apply(State& state) const applyTexParameters(GL_TEXTURE_2D,state); - if (textureObject->isAllocated()) + if (textureObject->isAllocated() && image->supportsTextureSubloading()) { //OSG_NOTICE<<"Reusing texture object"<