[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
Tue Sep 22 12:51:28 PDT 2015
I had an issue with OSG 3.4.0 when using a compressed 32x32 texture causing an INVALID_OPERATION in Texture::applyTexImage2D_load when calling glCompressTexSubImage2D. This is called only when the texture storage object is used. This resulted in the texture rendering as black. Note that the texture was loaded from a IVE file created with an earlier version of OSG.
After some investigation, I suspected that a possible cause was that the texture included mipmaps down to 2x2 and 1x1 in size. The S3TC compression being used has a block size of 4 so cannot be used for these small mipmap levels. Modifying numMipmapLevels by subtracting 2 if the image is compressed and using texture storage corrected the problem. However this is likely not the best solution.
My limited knowledge of OpenGL and this error suggests that this may be highly dependent on the OpenGL implementation. I had several other compressed textures larger than 32x32 with mipmaps down to 2x2 and 1x1 that worked fine without this change. The OpenGL documentation (see EXT_texture_compression_s3tc among others) however states that if the width or height are not multiples of 4 then the result is an INVALID_OPERATION. This can go unnoticed when not using a texture storage object. But with the texture storage object, the error was generated when loading the full texture (i.e. level 0).
If my understanding is correct, others may have had similar issues with compressed textures with mipmaps. They have worked around the issue by disabling mipmaps for compressed textures in ReaderWriterDDS for example. If the above holds true, then it may point to the underlying problem.
Windows 7 64-bit, nVidia Driver 352.86, OSG 3.4.0
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5651 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150922/b80103fb/attachment-0002.bin>
More information about the osg-users
mailing list