[osg-users] INVALID_OPERATION with compressed textures with mipmaps in OSG 3.4.0
Davis, Timothy S CTR comnavairsyscom
timothy.s.davis.ctr at navy.mil
Thu Sep 24 12:13:03 PDT 2015
Sorry. It keeps trying to encrypt the message.
Robert
While continuing to build a model that results in the problem, I discovered something I didn't see before. The IVE model had an incorrect number of mipmap levels (it had 8) for a 32x32 texture. It makes sense that glTexStorage2D would generate INVALID_OPERATION in this case. Rebuilding the model from a source with uncompressed textures and recompressing the textures worked. The original model was converted with a much older version of OSG, pre OSG 3 for sure.
So I was barking up the wrong tree:)
That addresses my specific issue without needing a change to OSG 3.4.0. However, I still think it is worth trying for the OSX case.
Trajce
In osg/Texture.cpp, function applyTexImage2D(), find the line:
useTexStorage &= sizedInternalFormat != 0;
add the following after the line:
if ( useTexStorage && compressed_image && numMipmapLevels > 2 )
{
numMipmapLevels -= 2;
}
This is clearly not production quality as it assumes block size is 4 and complete mipmaps to 1x1. It should be enough to check the approach. You may have to set GL_TEXTURE_MAX_LEVEL if the driver thinks the texture is incomplete, but I didn't have that issue.
Scott
More information about the osg-users
mailing list