File size: 982 Bytes
5db43ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
VERTEX_SHADER = """
#version 330 core
uniform mat4   model;         // Model matrix
uniform mat4   view;          // View matrix
uniform mat4   projection;    // Projection matrix
layout (location=0) in vec3 a_position;      // Vertex position
layout (location=1) in  vec2 a_texcoord;      // Vertex texture coordinates
out vec2   v_texcoord;      // Interpolated fragment texture coordinates (out)
void main()
{
    // Assign varying variables
    v_texcoord  = a_texcoord;
    // Final position
    gl_Position = projection * view * model * vec4(a_position,1.0);
    //gl_Position.z = 0.0;
}
"""

FRAGMENT_SHADER = """
#version 330 core
in vec2      v_texcoord; // Interpolated fragment texture coordinates (in)
out vec4 color;
out float gl_FragDepth;
uniform sampler2D u_texture;  // Texture 
void main()
{
    // Get texture color
    vec4 t_color = texture(u_texture, v_texcoord);
    color = t_color;
    // Final color
    //gl_FragColor = t_color;//vec4(1.0,0,0,1.0);
}
"""