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."
This commit is contained in:
@@ -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(");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user