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_vertex_shader.glsl
19 19

  
20 20
precision lowp float;
21 21

  
22
#if __VERSION__ != 100
23
in vec3 a_Position;                  // Per-vertex position.
24
in vec3 a_Normal;                    // Per-vertex normal vector.
25
in vec2 a_TexCoordinate;             // Per-vertex texture coordinate.
26
out vec3 v_Position;                 //
27
out vec3 v_Normal;                   //
28
out vec2 v_TexCoordinate;            //
29
#else
30
attribute vec3 a_Position;           // Per-vertex position.
31
attribute vec3 a_Normal;             // Per-vertex normal vector.
32
attribute vec2 a_TexCoordinate;      // Per-vertex texture coordinate.
33
varying vec3 v_Position;             //
34
varying vec3 v_Normal;               //
35
varying vec2 v_TexCoordinate;        //
36
#endif
37

  
22 38
uniform vec3 u_objD;                 // half of object width x half of object height X half the depth;
23 39
                                     // point (0,0,0) is the center of the object
24 40

  
......
26 42
                                     // I read OpenGL ES has a built-in uniform variable gl_DepthRange.near = n,
27 43
                                     // .far = f, .diff = f-n so maybe u_Depth is redundant
28 44
                                     // Update: this struct is only available in fragment shaders
29
                                
45

  
30 46
uniform mat4 u_MVPMatrix;            // the combined model/view/projection matrix.
31 47
uniform mat4 u_MVMatrix;             // the combined model/view matrix.
32
		 
33
in vec3 a_Position;                  // Per-vertex position.
34
in vec3 a_Normal;                    // Per-vertex normal vector.
35
in vec2 a_TexCoordinate;             // Per-vertex texture coordinate.
36
		  
37
out vec3 v_Position;                 //
38
out vec3 v_Normal;                   //
39
out vec2 v_TexCoordinate;            //
40 48

  
41 49
#if NUM_VERTEX>0
42 50
uniform int vNumEffects;             // total number of vertex effects

Also available in: Unified diff