swift502 / Sketchbook

3D playground built on three.js and cannon.js.
https://jblaha.art/sketchbook/latest
MIT License
1.46k stars 377 forks source link

texImage2D/PoT errors #17

Open StrandedKitty opened 4 years ago

StrandedKitty commented 4 years ago

When running the game (http://jblaha.art/03_alpha/index.html) on my Pixel 3a I get these errors in console:

image

As far as I know, your game uses WebGL 1 (THREE.WebGLRenderer is initialized without specifying any context). And WebGL 1 does not support mipmapping for non-power-of-two textures (basically, mipmapping for particular texture is turned on if Texture.minFilter is set to THREE.LinearMipmapLinearFilter, which is the default value). It may cause the errors on my device. Or it might be MAX_TEXTURE_SIZE of 4096.

Also you can try switching to WebGL 2. When using Three.js it can be easily done and it will eliminate all PoT problems.

swift502 commented 4 years ago

Hi, thanks for the report!

Similar WebGL errors pop up occasionally (seemingly at random) in my console even on PC. I'm pretty sure my textures have power-of-two sizes (I think three.js even warns you about it, and automatically converts any non-POT textures into POT textures), and they should definitely be less than 4096px in size.

So I don't know. I'll see if I find the time for this. I'm not terribly concerned about errors appearing on mobile devices, as the demo is not even playable on them at the moment.

But thanks for the report nonetheless! 🙂

Edit: As for WebGL 2, there's this cryptic message in How to use WebGL 2 which suggests POT textures are handled by three.js even without the need to switch to WebGL 2?