From 9a93d7ae06f3dc724efd43c384c1eae8317c3be1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 27 Jan 2005 20:18:49 +0000 Subject: [PATCH] Fixes to osg::Image's handling of compressed formats. --- src/osg/Image.cpp | 60 ++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index dc0c4745d..64ec27e1e 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -172,24 +172,37 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat) unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type) { - - if(format & 0x80F0) /* DXT* compressed formats */ + + switch(format) { - switch(format) - { - case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4; + case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 8; + case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 8; + default: break; + } - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4; - - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 8; - - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 8; - default: - { - notify(WARN)<<"error format = "<