ValhallaTeam / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

componentwise multiplication of vec4s are wrong #369

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) What steps will reproduce the problem?
The following fragment shader will produce it:

precision highp float;
void main()
{
    gl_FragColor = 0.0 * vec4(1.0, 1.0, 1.0, 1.0);
}

2) What is the expected output? What do you see instead?
The expected output is totally black fragments. I can see totally white 
fragments instead.

3) What version of the product are you using? On what operating system?
WebGL in stable Chrome version 21.0.1180.89 m
Win7 64 bit, Radeon 4850 with catalyst 12.6

Original issue reported on code.google.com by thek...@gmail.com on 25 Sep 2012 at 8:54

GoogleCodeExporter commented 9 years ago
I've tried that fragment shader in Shader Toy 
(http://www.iquilezles.org/apps/shadertoy/) and it shows up black as expected. 
Any other scalar factor also gives me the expected brightness.

Can you share a full test sample?

Original comment by nicolas....@gmail.com on 25 Sep 2012 at 1:32

GoogleCodeExporter commented 9 years ago
@thekend: be careful that you aren't seeing the effects of your completely 
transparent canvas blending with HTML content underneath it. If you are, you 
should either set alpha:false in your context creation attributes, disable 
alpha writes, clear the alpha channel to 1.0 after rendering, or something 
similar.

Original comment by kbr@chromium.org on 25 Sep 2012 at 5:10

GoogleCodeExporter commented 9 years ago
Ok, so it's obvious that the problem is not with the componentwise 
multiplication in GLSL.

This behaviour of transparent canvas blending with HTML content is weird, I 
will make more experiences with that.

In the shader:
gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);

In javascript:
gl.colorMask(true, true, true, true);
gl.clearColor(0.0, 0.0, 0.2, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.disable(gl.BLEND);
drawTriangle();

The drawn triangle is white. Is it correct with disabled blending?
If alpha mask is set to false before triangle rendering, its green as expected.

Original comment by thek...@gmail.com on 26 Sep 2012 at 8:38

GoogleCodeExporter commented 9 years ago
The behavior is as expected. If you have WebGL questions you should ask them on 
webgl-dev-list at 
https://groups.google.com/forum/?fromgroups#!forum/webgl-dev-list . Closing 
this bug.

Original comment by kbr@chromium.org on 26 Sep 2012 at 5:07