Project

General

Profile

« Previous | Next » 

Revision 94f6d472

Added by Leszek Koltunski about 7 years ago

Make it more flexible; now it can run almost all apps on OpenGL 2.0 contexts; OpenGL 3.0 ( with GLSL 3.00) required for POSTPROCESSING.

View differences:

src/main/res/raw/main_fragment_shader.glsl
18 18
//////////////////////////////////////////////////////////////////////////////////////////////
19 19

  
20 20
precision lowp float;
21
  
22
uniform sampler2D u_Texture;            // The input texture.
23
    
21

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

  
35
uniform sampler2D u_Texture;            // The input texture.
28 36

  
29 37
#if NUM_FRAGMENT>0
30 38
uniform int fNumEffects;                // total number of fragment effects
......
93 101

  
94 102
void main()                    		
95 103
  {  
96
  vec4 pixel = texture(u_Texture,v_TexCoordinate);
104
  vec4 pixel = TEXTURE(u_Texture,v_TexCoordinate);
97 105

  
98 106
#if NUM_FRAGMENT>0
99 107
  vec2 diff;
......
141 149
    }
142 150
#endif
143 151

  
144
  fragColor = vec4(pixel.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, pixel.a);
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);
145 159
  }

Also available in: Unified diff