KTX2 texture are black in WebGL1.0

KTX2 Texture, size:2048 x 1536.
WebGL2.0: Work well.
WebGL1.0: Black.
playground:
sample (2).zip (209.3 KB)

Can you look at what engine.getCaps() return in a console of the browser when you are in WebGL 1 mode?

For example, for me:

Look at the entries astc, bptc, etc1, etc2, pvrtc, s3tc, s3tc_srgb: if they are all null, it means compressed textures are not supported in WebGL 1 on your device.

3 Likes

Hello @Zion_Huang just checking in if you have any more questions

Sorry for the late response.
KTX is supported in WebGL 1 on my device:


The problem only occurs when the texture’s size is non-power-of-two.
I notice when WebGL version is 1, engine will default pad texture size into
power of two, so it seems the the padding fail on KTX texture.

In fact, we can’t do padding on compressed files because that would require decompressing + padding + recompressing, which is not possible.

So you need to use power-of-two textures from the start if you are aiming for WebGL 1.

3 Likes