Open mserege opened 8 months ago
This is a bug in Chrome. I will file the bug. It appears to only happen in Intel based Macs, not M1/M2 Macs
The reason it calls generateMipmap
is because the images each take a different amount of time to load. So, when you call twgl.createTexture
it returns a 1x1x1 cube map and then loads the images. When the first image is loaded (it could be any one of the 6). It copies that image to all 6 faces because otherwise the cubemap would stop working. All 6 faces have to be the same size and if they are not you'd get an error. Further, it calls generateMipmap because if you have filtering that needs mips it would fail suddenly. As each of the remaining 5 images comes in it applies them to the correct face and calls generateMipmap since otherwise the mips for that face would still be based on the first image loaded.
In any case, this a bug in Chrome. I'll post back here once I've made a smaller repo
Update, so it's got nothing to do with npot vs pot. It's a size issue, 2048x2048 also fails. It fails for me at 1813x1813 where as 1812x1812 works. Here's my repo, no twgl. And it only happens with images. If I use canvas it works.
On the other hand I just checked Chrome Canary and it works there so maybe there's no reason to file the bug. Just wait for a new version of Chrome.
Filed a bug anyway: https://bugs.chromium.org/p/chromium/issues/detail?id=1493252
Hi,
First, thanks a lot for this lib !
Just figured out that creating a cubemap texture based on non power of two images does not work propertly in Chrome on MacOS. Safari is fine, Chrome on Windows is also fine.
Here is the repro.
I checked loadCubemapFromUrls code and it seems to me that the fact that gl.generateMipmap(target) is called after each image upload might be the issue.
Is there a reason to do so ? If I move the call on the last image upload, it fixes the issue.
Let me know.
Thanks