WebGL fails when bindTexture receives a null texture |
||
Issue descriptionWhen trying to unbind a texture in WebGL, one would have to: gl.bindTexture(gl.TEXTURE_2D, null); (according to: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL ) This is currently failing when calling drawElements(), with: [.Offscreen-For-WebGL-0x7fa0210b5e00]RENDER WARNING: there is no texture bound to the unit 0 The attached example is the minimal example I could come up with. The expected result is for no warning to be shown and no texture bound. If the warning is cleared, I can also provide a bigger example to check if the texture is actually being unbound. (A similar problem has been seen on #586183 and on three.js: https://github.com/mrdoob/three.js/issues/8666 in the past. But I think those were related to image loading).
,
Feb 6 2017
Please notice on the example that, although the shader needs a texture, if I comment the bindTexture(..., null), the warning disappears.
,
Feb 6 2017
The warning seems relevant to me. Perhaps the lack of a warning when bindTexture is omitted is the problem?
,
Feb 6 2017
Apparently on 57 beta it does warn now. And it does stop without a Sampler on the fragment shader. I see the use of the warning, as it may be a bug on one's code that they have a shader with texture and no texture being bound. But also, it seems to be a well defined behaviour on WebGL that unbound textures return 0,0,0,1. Is there a way to tell webgl that "chill, I got this, this texture is optional"? If not, I guess it boils down to: is the "unbound default" a common case or is it so fringy that it's worth warning for the mistake case.
,
Feb 8 2017
The browser has to do some work in order to cause unbound textures to return (0, 0, 0, 1). Chromium doesn't trust the graphics driver to do the right thing in all cases. Therefore this is a performance warning and is working as intended. |
||
►
Sign in to add a comment |
||
Comment 1 by fs...@chromium.org
, Feb 6 2017