[WebGL2] Texture Internal Format discussion

I would like to open a discussion about internal format, and how we could integrate them without breaking the current Three.js API.

So, right now, the internal format is derived from the format, like this.

What I did on my side, is to add an attribute inside the Texture class, which represents the internal format, but is not given through the constructor, but rather explicitely:

const texture = new THREE.DataTexture(data, width, height);
texture.internalFormat = THREE.RGBA8UIFormat;

I also added support for unsgined integer sampler, etc… And everything seems to work great.

What do you think about this change? I agree it’s not the best regarding the API, but at least it backward compatible with WebGL1.

Author: Fantashit

1 thought on “[WebGL2] Texture Internal Format discussion

Comments are closed.