Skip to content

Commit 2d94d8d

Browse files
authored
[examples] Fix PBR and Shadowmap example shaders for GLSL 1.20 (#4167)
* Update pbr.fs remove presicion mediump float because it is for GLES, and not desktop GL * Fix shadowmap.fs also suffers the same problem as pbr.fs
1 parent aa70d32 commit 2d94d8d

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

examples/shaders/resources/shaders/glsl120/pbr.fs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#version 120
22

3-
precision mediump float;
4-
53
#define MAX_LIGHTS 4
64
#define LIGHT_DIRECTIONAL 0
75
#define LIGHT_POINT 1
@@ -17,12 +15,12 @@ struct Light {
1715
};
1816

1917
// Input vertex attributes (from vertex shader)
20-
varying in vec3 fragPosition;
21-
varying in vec2 fragTexCoord;
22-
varying in vec4 fragColor;
23-
varying in vec3 fragNormal;
24-
varying in vec4 shadowPos;
25-
varying in mat3 TBN;
18+
varying vec3 fragPosition;
19+
varying vec2 fragTexCoord;
20+
varying vec4 fragColor;
21+
varying vec3 fragNormal;
22+
varying vec4 shadowPos;
23+
varying mat3 TBN;
2624

2725

2826
// Input uniform values
@@ -153,4 +151,4 @@ void main()
153151

154152
gl_FragColor = vec4(color,1.0);
155153

156-
}
154+
}

examples/shaders/resources/shaders/glsl120/shadowmap.fs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#version 120
22

3-
precision mediump float;
4-
53
// This shader is based on the basic lighting shader
64
// This only supports one light, which is directional, and it (of course) supports shadows
75

86
// Input vertex attributes (from vertex shader)
9-
varying in vec3 fragPosition;
10-
varying in vec2 fragTexCoord;
7+
varying vec3 fragPosition;
8+
varying vec2 fragTexCoord;
119
//varying in vec4 fragColor;
12-
varying in vec3 fragNormal;
10+
varying vec3 fragNormal;
1311

1412
// Input uniform values
1513
uniform sampler2D texture0;

0 commit comments

Comments
 (0)