Skip to content

Commit 54ccb18

Browse files
committed
Update write_depth.fs
1 parent 3d64598 commit 54ccb18

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
#version 330
22

3+
// Input vertex attributes (from vertex shader)
34
in vec2 fragTexCoord;
45
in vec4 fragColor;
56

7+
// Input uniform values
68
uniform sampler2D texture0;
79
uniform vec4 colDiffuse;
810

11+
// Output fragment color
12+
out vec4 finalColor;
13+
914
void main()
1015
{
11-
vec4 texelColor = texture2D(texture0, fragTexCoord);
16+
vec4 texelColor = texture(texture0, fragTexCoord);
1217

13-
gl_FragColor = texelColor*colDiffuse*fragColor;
14-
gl_FragDepth = 1.0 - gl_FragCoord.z;
18+
finalColor = texelColor*colDiffuse*fragColor;
19+
gl_FragDepth = 1.0 - finalColor.z;
1520
}

0 commit comments

Comments
 (0)