From d7f1c34df8d2996011a7285d96f37767f691906a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 5 Jul 2006 21:52:36 +0000 Subject: [PATCH] From Eric Sokolowsky, "The attached Texture.cpp fixes a problem when subloading compressed textures. Near the top of the function that implements texture subloading, osg::Texture::applyTexImage2D_subload(), the local variable compressed_image examines the _image's_ pixel format to see if it is compressed. However, further on, in calls to getCompressedSize() the _texture's_ pixel format is used. In my application's Texture2D class, I use osg::Texture::USE_ARB_COMPRESSION to osg::Texture2D::setInternalFormatMode(), which causes the internal format to become one of the generic ARB_COMPRESSED types, which do not have a specific size. Thus the recent warning message added to osg::Texture::getCompressedSize() is triggered. The correct behavior is to use the format mode from the Image class instead of the Texture class within the subload implementation, and then the size is calculated correctly." --- src/osg/Texture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 04f84efd1..d97cc7c07 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1139,7 +1139,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* else if (extensions->isCompressedTexImage2DSupported()) { GLint blockSize,size; - getCompressedSize(_internalFormat, inwidth, inheight, 1, blockSize,size); + getCompressedSize(image->getInternalTextureFormat(), inwidth, inheight, 1, blockSize,size); extensions->glCompressedTexSubImage2D(target, 0, 0,0, @@ -1191,7 +1191,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* if (height == 0) height = 1; - getCompressedSize(_internalFormat, width, height, 1, blockSize,size); + getCompressedSize(image->getInternalTextureFormat(), width, height, 1, blockSize,size); //state.checkGLErrors("before extensions->glCompressedTexSubImage2D(");