REVIEWED: shaders_write_depth example

This commit is contained in:
Ray 2023-01-01 18:31:03 +01:00
parent 3cfb9a6e83
commit 5ba41e4f7f
3 changed files with 107 additions and 84 deletions

View file

@ -7,9 +7,11 @@ 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;
gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
}

View file

@ -5,9 +5,11 @@ 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;
}
gl_FragDepth = 1.0 - gl_FragCoord.z;
}