diff --git a/src/osgPlugins/tga/ReaderWriterTGA.cpp b/src/osgPlugins/tga/ReaderWriterTGA.cpp index 861c61b70..53da479ac 100644 --- a/src/osgPlugins/tga/ReaderWriterTGA.cpp +++ b/src/osgPlugins/tga/ReaderWriterTGA.cpp @@ -564,16 +564,17 @@ class ReaderWriterTGA : public osgDB::ReaderWriter int t = height_ret; int r = 1; - int internalFormat = numComponents_ret; - unsigned int pixelFormat = numComponents_ret == 1 ? GL_LUMINANCE : - numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : - numComponents_ret == 3 ? GL_RGB : - numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : + numComponents_ret == 3 ? GL_RGB : + numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + + int internalFormat = pixelFormat; unsigned int dataType = GL_UNSIGNED_BYTE; + osg::Image* pOsgImage = new osg::Image; pOsgImage->setImage(s,t,r, internalFormat,