oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.71k stars 211 forks source link

MipMaps get disabled on non-POT even on WebGL2 #179

Closed coomdev closed 1 year ago

coomdev commented 1 year ago

https://github.com/oframe/ogl/blob/8d86f500d04c3e7a16217e20e17fcb2650cf3522/src/extras/TextureLoader.js#L157

Happens when using the .load method, other paths do properly check for WebGL2, except this one, so mipmaps get disabled even though they're supported.

gordonnl commented 1 year ago

Thanks for finding that!

coomdev commented 1 year ago

Also, two lines below, you're only changing the image filter if it's set to NEAREST_MIPMAP_LINEAR, but NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST and LINEAR_MIPMAP_LINEAR also are values that are valid in WebGL1. Since the filter is not reset for these, this would causes rendering issues when using NPOT textures in WebGL1 contexts.