diff options
Diffstat (limited to 'examples/shaders/resources')
| -rw-r--r-- | examples/shaders/resources/shaders/glsl100/write_depth.fs | 15 | ||||
| -rw-r--r-- | examples/shaders/resources/shaders/glsl330/write_depth.fs | 13 |
2 files changed, 28 insertions, 0 deletions
diff --git a/examples/shaders/resources/shaders/glsl100/write_depth.fs b/examples/shaders/resources/shaders/glsl100/write_depth.fs new file mode 100644 index 00000000..5167efb8 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/write_depth.fs @@ -0,0 +1,15 @@ +#version 100 +#extension GL_EXT_frag_depth : enable +precision mediump float; // Precision required for OpenGL ES2 (WebGL) + +varying vec2 fragTexCoord; +varying vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; +void main() +{ + vec4 texelColor = texture2D(texture0, fragTexCoord); + gl_FragColor = texelColor*colDiffuse*fragColor; + gl_FragDepthEXT = 1.0 - gl_FragCoord.z; +}
\ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/write_depth.fs b/examples/shaders/resources/shaders/glsl330/write_depth.fs new file mode 100644 index 00000000..36c70fe4 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl330/write_depth.fs @@ -0,0 +1,13 @@ +#version 330 + +in vec2 fragTexCoord; +in vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; +void main() +{ + vec4 texelColor = texture2D(texture0, fragTexCoord); + gl_FragColor = texelColor*colDiffuse*fragColor; + gl_FragDepth = 1.0 - gl_FragCoord.z; +}
\ No newline at end of file |
