From 5423add9e23fb3c093eb3149ae4b4e3f5feecfe4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 6 Mar 2007 11:20:39 +0000 Subject: [PATCH] Added support for 4,7,12,16 bit luminance and intensity formats --- src/osg/Image.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index cf99615c7..f8d86d588 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -195,9 +195,23 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat) case(GL_RGBA): return 4; case(GL_BGRA): return 4; case(GL_LUMINANCE): return 1; + case(GL_LUMINANCE4): return 1; + case(GL_LUMINANCE8): return 1; + case(GL_LUMINANCE12): return 1; + case(GL_LUMINANCE16): return 1; case(GL_LUMINANCE16F_ARB): return 1; case(GL_LUMINANCE32F_ARB): return 1; + case(GL_LUMINANCE4_ALPHA4): return 2; + case(GL_LUMINANCE6_ALPHA2): return 2; + case(GL_LUMINANCE8_ALPHA8): return 2; + case(GL_LUMINANCE12_ALPHA4): return 2; + case(GL_LUMINANCE12_ALPHA12): return 2; + case(GL_LUMINANCE16_ALPHA16): return 2; case(GL_INTENSITY): return 1; + case(GL_INTENSITY4): return 1; + case(GL_INTENSITY8): return 1; + case(GL_INTENSITY12): return 1; + case(GL_INTENSITY16): return 1; case(GL_INTENSITY16F_ARB): return 1; case(GL_INTENSITY32F_ARB): return 1; case(GL_LUMINANCE_ALPHA): return 2; @@ -251,6 +265,25 @@ unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type) default: break; } + switch(format) + { + case(GL_LUMINANCE4): return 4; + case(GL_LUMINANCE8): return 8; + case(GL_LUMINANCE12): return 12; + case(GL_LUMINANCE16): return 16; + case(GL_LUMINANCE4_ALPHA4): return 8; + case(GL_LUMINANCE6_ALPHA2): return 8; + case(GL_LUMINANCE8_ALPHA8): return 16; + case(GL_LUMINANCE12_ALPHA4): return 16; + case(GL_LUMINANCE12_ALPHA12): return 24; + case(GL_LUMINANCE16_ALPHA16): return 32; + case(GL_INTENSITY4): return 4; + case(GL_INTENSITY8): return 8; + case(GL_INTENSITY12): return 12; + case(GL_INTENSITY16): return 16; + default: break; + } + switch(type) {