Update default shaders in documentation of webgl classes

This commit is contained in:
Olivier Guyot
2018-12-07 09:30:06 +01:00
parent 8e4c66a49e
commit 27b0cf18e7
2 changed files with 6 additions and 2 deletions

View File

@@ -126,14 +126,13 @@ const FRAGMENT_SHADER = `
* * Fragment shader: * * Fragment shader:
* ``` * ```
* precision mediump float; * precision mediump float;
* uniform float u_opacity;
* *
* varying vec2 v_texCoord; * varying vec2 v_texCoord;
* varying float v_opacity; * varying float v_opacity;
* *
* void main(void) { * void main(void) {
* gl_FragColor.rgb = vec3(1.0, 1.0, 1.0); * gl_FragColor.rgb = vec3(1.0, 1.0, 1.0);
* float alpha = u_opacity * v_opacity; * float alpha = v_opacity;
* if (alpha == 0.0) { * if (alpha == 0.0) {
* discard; * discard;
* } * }

View File

@@ -55,6 +55,10 @@ const DEFAULT_FRAGMENT_SHADER = `
* This class is used to define Post Processing passes with custom shaders and uniforms. * This class is used to define Post Processing passes with custom shaders and uniforms.
* This is used internally by {@link module:ol/webgl/Helper~WebGLHelper}. * This is used internally by {@link module:ol/webgl/Helper~WebGLHelper}.
* *
* Please note that the final output on the DOM canvas is expected to have premultiplied alpha, which means that
* a pixel which is 100% red with an opacity of 50% must have a color of (r=0.5, g=0, b=0, a=0.5).
* Failing to provide pixel colors with premultiplied alpha will result in render anomalies.
*
* Default shaders are shown hereafter: * Default shaders are shown hereafter:
* *
* * Vertex shader: * * Vertex shader:
@@ -87,6 +91,7 @@ const DEFAULT_FRAGMENT_SHADER = `
* *
* void main() { * void main() {
* gl_FragColor = texture2D(u_image, v_texCoord); * gl_FragColor = texture2D(u_image, v_texCoord);
* gl_FragColor.rgb *= gl_FragColor.a;
* } * }
* ``` * ```
* *