From 9a7c9b2a50b5800a62031eb621e5a4ad7fcd7633 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 23 Jan 2013 11:45:31 +0000 Subject: [PATCH] From Lukasz Izdebski, "I found problem with rgb plugin. Internal format of rgb image is wrongly set ( diffrent then in other images type plugin ), because of that using rgb images in osg::Texture2DArray causes a bug." --- src/osgPlugins/rgb/ReaderWriterRGB.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/osgPlugins/rgb/ReaderWriterRGB.cpp b/src/osgPlugins/rgb/ReaderWriterRGB.cpp index fae67a6c2..6bc0f397f 100644 --- a/src/osgPlugins/rgb/ReaderWriterRGB.cpp +++ b/src/osgPlugins/rgb/ReaderWriterRGB.cpp @@ -481,18 +481,19 @@ class ReaderWriterRGB : public osgDB::ReaderWriter int s = raw->sizeX; int t = raw->sizeY; int r = 1; - - #if 0 - int internalFormat = raw->sizeZ == 3 ? GL_RGB5 : - raw->sizeZ == 4 ? GL_RGB5_A1 : GL_RGB; - #else - int internalFormat = raw->sizeZ; - #endif + unsigned int pixelFormat = raw->sizeZ == 1 ? GL_LUMINANCE : raw->sizeZ == 2 ? GL_LUMINANCE_ALPHA : raw->sizeZ == 3 ? GL_RGB : raw->sizeZ == 4 ? GL_RGBA : (GLenum)-1; + #if 0 + int internalFormat = raw->sizeZ == 3 ? GL_RGB5 : + raw->sizeZ == 4 ? GL_RGB5_A1 : GL_RGB; + #else + int internalFormat = pixelFormat; + #endif + unsigned int dataType = raw->bpc == 1 ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;