New issue
Advanced search Search tips

Issue 823176 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

WebGL 1 readPixels doesn't properly support formats

Project Member Reported by fs...@chromium.org, Mar 19 2018

Issue description

If you try to readPixels with format ALPHA on a RGBA texture, readPixels fails with:
"glReadPixels: format and type incompatible with the current read framebuffer"

It seems to me, from the spec, that format ALPHA should discard RGB and read alpha, instead of complaining that this is not a pure alpha texture.

Sample code:
texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 100, 100, 0, gl.RGBA, gl.UNSIGNED_BYTE, img);
fb = gl.createFramebuffer();
gl.bindFrameBuffer(fb);
gl.framebufferTextuer2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
buffer = new Uint8Array(100*100);
gl.readPixels(0, 0, 100, 100, gl.ALPHA, gl.UNSIGNED_BYTE, buffer);


I can write a full example later, if needed.
It seems, from checking gles2_cmd_decoder, that we don't even allow this format as a read input. :/


 

Comment 1 by fs...@chromium.org, Mar 19 2018

Status: WontFix (was: Untriaged)
It seems the spec says only RGBA is allowed, but the Mozilla docs are wrong.
Closing this.

Sign in to add a comment