Closed solidpixel closed 2 years ago
Actually it is libktx that is throwing the error. The code comment which you originally included in the issue report explains why.
// glInternalFormat is either unsized (which is no longer and should
// never have been supported by libktx) or glFormat is sized.
Note the part in parentheses.
In a KTX file you should specify as glInternalFormat
the appropriate sized LUMINANCE format for the glType
, e.g. GL_LUMINANCE8_ALPHA8
. Specify, e.g. GL_LUMINANCE_ALPHA as the format
and glBaseInternalFormat
. A GL loader when loading to older versions such as OpenGL ES 2.0 should use the glBaseInternalFormat
field value as internalformat
parameter of glTex{,Sub}Image2D
. ktxTexture_GLupload
does this.
Thanks Mark.
I think it is intended that KTX1 supports the legacy
GL_LUMINANCE
andGL_LUMINANCE_ALPHA
pixel formats, given that it doesn't allow theKTXswizzle
metadata that KTX2 has. For OpenGL ES 2.0glTexSubImage2D()
for these formats you specify theLUM/LUM_ALP
as both the "internalFormat" and the "format", as there is no sized equivalent.Currently
ktxinfo
throws an error that the format is invalid ifformat
andinternalFormat
are the same. Am I handling these wrong?