From c83bc830cd8ecca83cfbb4ea15f4b185b7e89058 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 3 Sep 2007 09:50:50 +0000 Subject: [PATCH] From Sherman Wilcox, "I modified texturerectangle.cpp to address this issue. I used a DXT5 DDS file to test the change." --- src/osg/TextureRectangle.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/osg/TextureRectangle.cpp b/src/osg/TextureRectangle.cpp index dbf32d186..5aa1a4274 100644 --- a/src/osg/TextureRectangle.cpp +++ b/src/osg/TextureRectangle.cpp @@ -294,12 +294,21 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st pbo = 0; } - // UH: ignoring compressed for now. - glTexImage2D(target, 0, _internalFormat, - image->s(), image->t(), 0, - (GLenum)image->getPixelFormat(), - (GLenum)image->getDataType(), - image->data() - dataMinusOffset + dataPlusOffset ); + if(isCompressedInternalFormat(_internalFormat) && extensions->isCompressedTexImage2DSupported()) + { + extensions->glCompressedTexImage2D(target, 0, _internalFormat, + image->s(), image->t(), 0, + image->getImageSizeInBytes(), + image->data() - dataMinusOffset + dataPlusOffset); + } + else + { + glTexImage2D(target, 0, _internalFormat, + image->s(), image->t(), 0, + (GLenum)image->getPixelFormat(), + (GLenum)image->getDataType(), + image->data() - dataMinusOffset + dataPlusOffset ); + } if (pbo)