question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[WebGL2] Texture Internal Format discussion

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
DavidPeichocommented, Oct 10, 2018

Sorry, I was in long holidays. It will be done this week end. @takahirox

1reaction
takahiroxcommented, Aug 27, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found