Update default shaders in documentation of webgl classes
This commit is contained in:
@@ -126,14 +126,13 @@ const FRAGMENT_SHADER = `
|
||||
* * Fragment shader:
|
||||
* ```
|
||||
* precision mediump float;
|
||||
* uniform float u_opacity;
|
||||
*
|
||||
* varying vec2 v_texCoord;
|
||||
* varying float v_opacity;
|
||||
*
|
||||
* void main(void) {
|
||||
* gl_FragColor.rgb = vec3(1.0, 1.0, 1.0);
|
||||
* float alpha = u_opacity * v_opacity;
|
||||
* float alpha = v_opacity;
|
||||
* if (alpha == 0.0) {
|
||||
* discard;
|
||||
* }
|
||||
|
||||
@@ -55,6 +55,10 @@ const DEFAULT_FRAGMENT_SHADER = `
|
||||
* 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}.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* * Vertex shader:
|
||||
@@ -87,6 +91,7 @@ const DEFAULT_FRAGMENT_SHADER = `
|
||||
*
|
||||
* void main() {
|
||||
* gl_FragColor = texture2D(u_image, v_texCoord);
|
||||
* gl_FragColor.rgb *= gl_FragColor.a;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user