Project

General

Profile

« Previous | Next » 

Revision 1cbf4103

Added by Leszek Koltunski over 7 years ago

Simplify shaders.

View differences:

src/main/res/raw/blit_fragment_shader.glsl
20 20
precision lowp float;
21 21

  
22 22
#if __VERSION__ != 100
23
#define TEXTURE texture
24 23
out vec4 fragColor;           // The output color
25 24
in vec2 v_TexCoordinate;      // Interpolated texture coordinate per fragment.
25
#define TEXTURE texture
26
#define FRAG_COLOR fragColor
26 27
#else
27
#define TEXTURE texture2D
28 28
varying vec2 v_TexCoordinate; // Interpolated texture coordinate per fragment.
29
#define TEXTURE texture2D
30
#define FRAG_COLOR gl_FragColor
29 31
#endif
30 32

  
31 33
uniform sampler2D u_Texture;  // The input texture.
......
34 36

  
35 37
void main()                    		
36 38
  {
37
#if __VERSION__ != 100
38
  fragColor    =
39
#else
40
  gl_FragColor =
41
#endif
42

  
43
  TEXTURE(u_Texture,v_TexCoordinate);
39
  FRAG_COLOR = TEXTURE(u_Texture,v_TexCoordinate);
44 40
  }
src/main/res/raw/blur1_fragment_shader.glsl
20 20
precision lowp float;
21 21

  
22 22
#if __VERSION__ != 100
23
#define TEXTURE texture
24 23
in vec2 v_TexCoordinate;
25 24
out vec4 fragColor;
25
#define TEXTURE texture
26
#define FRAG_COLOR fragColor
26 27
#else
27
#define TEXTURE texture2D
28 28
varying vec2 v_TexCoordinate;
29
#define TEXTURE texture2D
30
#define FRAG_COLOR gl_FragColor
29 31
#endif
30 32

  
31 33
uniform sampler2D u_ColorTexture;
......
45 47
               TEXTURE(u_ColorTexture,vec2(v_TexCoordinate.x-u_Offsets[i],v_TexCoordinate.y)) ) * u_Weights[i];
46 48
    }
47 49

  
48
#if __VERSION__ != 100
49
  fragColor    =
50
#else
51
  gl_FragColor =
52
#endif
53

  
54
  pixel;
50
  FRAG_COLOR = pixel;
55 51
  }
src/main/res/raw/blur2_fragment_shader.glsl
20 20
precision lowp float;
21 21

  
22 22
#if __VERSION__ != 100
23
#define TEXTURE texture
24 23
in vec2 v_TexCoordinate;
25 24
out vec4 fragColor;
25
#define TEXTURE texture
26
#define FRAG_COLOR fragColor
26 27
#else
27
#define TEXTURE texture2D
28 28
varying vec2 v_TexCoordinate;
29
#define TEXTURE texture2D
30
#define FRAG_COLOR gl_FragColor
29 31
#endif
30 32

  
31 33
uniform sampler2D u_ColorTexture;
......
48 50
               TEXTURE(u_ColorTexture,vec2(v_TexCoordinate.x-u_Offsets[i],v_TexCoordinate.y)) ) * u_Weights[i];
49 51
    }
50 52

  
51
#if __VERSION__ != 100
52
  fragColor    =
53
#else
54
  gl_FragColor =
55
#endif
56

  
57
  pixel;
53
  FRAG_COLOR = pixel;
58 54
  }
src/main/res/raw/main_fragment_shader.glsl
20 20
precision lowp float;
21 21

  
22 22
#if __VERSION__ != 100
23
#define TEXTURE texture
24 23
in vec3 v_Position;                     // Interpolated position for this fragment.
25 24
in vec3 v_Normal;                       // Interpolated normal for this fragment.
26 25
in vec2 v_TexCoordinate;                // Interpolated texture coordinate per fragment.
27 26
out vec4 fragColor;                     // The output color
27
#define TEXTURE texture
28
#define FRAG_COLOR fragColor
28 29
#else
29
#define TEXTURE texture2D
30 30
varying vec3 v_Position;                // Interpolated position for this fragment.
31 31
varying vec3 v_Normal;                  // Interpolated normal for this fragment.
32 32
varying vec2 v_TexCoordinate;           // Interpolated texture coordinate per fragment.
33
#define TEXTURE texture2D
34
#define FRAG_COLOR gl_FragColor
33 35
#endif
34 36

  
35 37
uniform sampler2D u_Texture;            // The input texture.
......
149 151
    }
150 152
#endif
151 153

  
152
#if __VERSION__ != 100
153
  fragColor    =
154
#else
155
  gl_FragColor =
156
#endif
157

  
158
  vec4(pixel.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, pixel.a);
154
  FRAG_COLOR = vec4(pixel.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, pixel.a);
159 155
  }
src/main/res/raw/test_fragment_shader.glsl
21 21

  
22 22
#if __VERSION__ != 100
23 23
out vec4 fragColor;
24
#define FRAG_COLOR fragColor
25
#else
26
#define FRAG_COLOR gl_FragColor
24 27
#endif
25 28

  
26 29
//////////////////////////////////////////////////////////////////////////////////////////////
27 30

  
28 31
void main()
29 32
  {
30
#if __VERSION__ != 100
31
  fragColor    =
32
#else
33
  gl_FragColor =
34
#endif
35

  
36
  vec4(1.0,0.0,0.0,0.2);
33
  FRAG_COLOR = vec4(1.0,0.0,0.0,0.2);
37 34
  }

Also available in: Unified diff