OpenGL2: Don't use initialized arrays in glsl shaders.

Unsupported in GLSL 1.20 (Mac OS X 10.6)
This commit is contained in:
SmileTheory 2017-07-24 16:29:04 -07:00
parent 67dace6c20
commit 356ae10ef6
3 changed files with 38 additions and 3 deletions

View file

@ -11,7 +11,15 @@ void main()
vec2 tc;
#if 0
float c[7] = float[7](1.0, 0.9659258263, 0.8660254038, 0.7071067812, 0.5, 0.2588190451, 0.0);
float c[7];
c[0] = 1.0;
c[1] = 0.9659258263;
c[2] = 0.8660254038;
c[3] = 0.7071067812;
c[4] = 0.5;
c[5] = 0.2588190451;
c[6] = 0.0;
tc = var_TexCoords + u_InvTexRes * vec2( c[0], c[6]); color = texture2D(u_TextureMap, tc);
tc = var_TexCoords + u_InvTexRes * vec2( c[1], c[5]); color += texture2D(u_TextureMap, tc);
@ -44,7 +52,13 @@ void main()
gl_FragColor = color * 0.04166667 * u_Color;
#endif
float c[5] = float[5](1.0, 0.9238795325, 0.7071067812, 0.3826834324, 0.0);
float c[5];
c[0] = 1.0;
c[1] = 0.9238795325;
c[2] = 0.7071067812;
c[3] = 0.3826834324;
c[4] = 0.0;
tc = var_TexCoords + u_InvTexRes * vec2( c[0], c[4]); color = texture2D(u_TextureMap, tc);
tc = var_TexCoords + u_InvTexRes * vec2( c[1], c[3]); color += texture2D(u_TextureMap, tc);