texture.readPixels() fails on basis textures

Check out this playground from the docs!

In the console log you will see the following error:

[.WebGL-0x7f9472017200]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glReadPixels: framebuffer incomplete

I am trying to use GPU optimized compressed textures for my sprites but am unable to as picking sprites requires the textures to be read out (when using alpha on the pick).

Yes unfortunately it is not possible to read compressed data. You first need to copy it to a uncompressed texture

You can use BABYLON | Babylon.js Documentation (babylonjs.com) to get a copy :slight_smile:

2 Likes

Awesome! This should work, I have a custom SpriteManager class now which adds support for Level Of Detail and Child/Parent sprite chaining (with support for local positions as they relate to the sprite coordinates). I’ll just need to override the picking mechanics such that we first create a rasterized copy, that should suffice. Thank you so much for this.

1 Like