I'm debugging some unfamiliar code, and am getting the following 3 when it's loading KTX2 textures:
THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()
WebGL warning: compressedTexSubImage: format must match the format of the existing texture image.
WebGL warning: blitFramebuffer: DRAW_FRAMEBUFFER may not have multiple samples.
The textures are also loading in as black, which I believe is linked to the warnings.
I've managed to track it down to these bits of code
this.ktx2Loader = new KTX2Loader(this.manager).detectSupport(editor.renderer.renderer);
...
loader = this.ktx2Loader;
const texture = await loadTexture(textureUrl, loader);
...
function loadTexture(src, textureLoader = new TextureLoader()) {
return new Promise((resolve, reject) => {
textureLoader.load(src, resolve, null, error => reject(new RethrownError(`Error loading texture "${src}"`, error)));
});
}
And that's where it disappears into ThreeJS internal code that I'm not experienced enough to know how to handle.
The formats are loading in with a format of 36492 which I believe is KTX2 from what I can tell, so I'm a little unsure of what's causing the error. Stranger still it's working on some co-workers machines, but not my own.
Anyone know what might be going on?
The compressed format you try to load (36492 or 0x8E8C) is EXT_texture_compression_bptc and more specifically COMPRESSED_RGBA_BPTC_UNORM_EXT (aka BC7)
Here is the webgl spec
Any compressed format support in webgl is provided as an extension. As such you cannot assume that any format is supported for a given platform/hardware. Generally, each OS require it's own set.
To properly use compressed texture in webgl, you need to export various formats, and based on runtime capabilities tests, load the proper one. And ultimatly, always provide a non compressed fallback(jpg, png, webp...).
Note that KTX is just a container and not a compression format/codec. It can contain any format AFAIK.