From d4c46df7cea6e638aa6c247254bedb4b9fde1389 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 29 Jun 2004 08:03:28 +0000 Subject: [PATCH] Fixed parsing of internalTextureFormat. --- src/osgPlugins/osg/Texture.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/osgPlugins/osg/Texture.cpp b/src/osgPlugins/osg/Texture.cpp index 58f3470e8..0904f06fb 100644 --- a/src/osgPlugins/osg/Texture.cpp +++ b/src/osgPlugins/osg/Texture.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -145,7 +146,7 @@ bool Texture_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } - if (fr[0].matchWord("internalFormatValue")) + if (fr[0].matchWord("internalFormat")) { int value; if (Texture_matchInternalFormatStr(fr[1].getStr(),value) || fr[1].getInt(value)) @@ -179,14 +180,15 @@ bool Texture_writeLocalData(const Object& obj, Output& fw) fw.indent() << "unRefImageDataAfterApply "<< (texture.getUnRefImageDataAfterApply()?"TRUE":"FALSE") << std::endl; fw.indent() << "internalFormatMode " << Texture_getInternalFormatModeStr(texture.getInternalFormatMode()) << std::endl; - if (texture.getInternalFormatMode()==Texture::USE_USER_DEFINED_FORMAT) { + const char* str = Texture_getInternalFormatStr(texture.getInternalFormat()); + if (str) fw.indent() << "internalFormat " << str << std::endl; else fw.indent() << "internalFormat " << texture.getInternalFormat() << std::endl; - } + } return true; } @@ -275,7 +277,6 @@ const char* Texture_getInternalFormatModeStr(Texture::InternalFormatMode mode) bool Texture_matchInternalFormatStr(const char* str,int& value) { - if ( strcmp(str,"GL_INTENSITY")==0) value = GL_INTENSITY; else if (strcmp(str,"GL_LUMINANCE")==0) value = GL_LUMINANCE; else if (strcmp(str,"GL_ALPHA")==0) value = GL_ALPHA; @@ -318,6 +319,5 @@ const char* Texture_getInternalFormatStr(int value) case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"; case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"; } - return NULL; }