[WebGL2] Texture Internal Format discussion
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Problems using internal formats other than R8 for texture data
Problems using internal formats other than R8 for texture data. I'm using GLSL shaders with 3D texture data in WebGL2 code via TypeScript....
Read more >WebGL2 What's New
In WebGL2 you can look up values from a texture by pixel/texel coordinates directly making array access slightly easier: vec4 values = texelFetch(sampler,...
Read more >WebGL 2.0 Specification - Khronos Registry
Generates INVALID_OPERATION when `internalFormat == DEPTH_STENCIL && samples > 0`. 3.7.6 Texture objects. Texture objects provide storage and ...
Read more >WebGL 2: New Features - Real-Time Rendering
Here is a list of the new texture features in WebGL 2. ... gl.texImage2D( gl.TEXTURE_2D, 0, // Level of details gl.SRGB8, // Format...
Read more >WebGL Rendering to a Texture
How to render to a texture. ... TEXTURE_2D, level, internalFormat,; targetTextureWidth, targetTextureHeight, border,; format, type, data); ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I was in long holidays. It will be done this week end. @takahirox
I see.
Until we move to such style APIs, only custom internal format needs to be setup via
.setXXX()
method, not via constructor. But it may be ok, I guess not so many users wanna set internal format by themselves. It may be acceptable.