Fix the shader to be compatible with GLSL 1.2

This commit is contained in:
Kitlith 2015-05-08 19:41:16 -07:00
parent c036688d88
commit bca0739604

View File

@ -7,19 +7,16 @@
namespace GLShaders { namespace GLShaders {
const char g_vertex_shader[] = R"( const char g_vertex_shader[] = R"(
#version 130 #version 120
in vec2 vert_position; in vec2 vert_position;
in vec2 vert_tex_coord; in vec2 vert_tex_coord;
out vec2 frag_tex_coord; varying out vec2 frag_tex_coord;
// This is a truncated 3x3 matrix for 2D transformations: // This is a truncated 3x3 matrix for 2D transformations:
// The upper-left 2x2 submatrix performs scaling/rotation/mirroring. // The upper-left 2x2 submatrix performs scaling/rotation/mirroring.
// The third column performs translation. // The third column performs translation.
// The third row could be used for projection, which we don't need in 2D. It hence is assumed to // The third row could be used for projection, which we don't need in 2D. It hence is assumed to
// implicitly be [0, 0, 1] // implicitly be [0, 0, 1]
uniform mat3x2 modelview_matrix; uniform mat3x2 modelview_matrix;
void main() { void main() {
// Multiply input position by the rotscale part of the matrix and then manually translate by // Multiply input position by the rotscale part of the matrix and then manually translate by
// the last column. This is equivalent to using a full 3x3 matrix and expanding the vector // the last column. This is equivalent to using a full 3x3 matrix and expanding the vector
@ -30,15 +27,12 @@ void main() {
)"; )";
const char g_fragment_shader[] = R"( const char g_fragment_shader[] = R"(
#version 130 #version 120
varying in vec2 frag_tex_coord;
in vec2 frag_tex_coord; varying out vec4 color;
out vec4 color;
uniform sampler2D color_texture; uniform sampler2D color_texture;
void main() { void main() {
color = texture(color_texture, frag_tex_coord); color = texture2D(color_texture, frag_tex_coord);
} }
)"; )";