tomaka / glium_text

Text rendering with glium
48 stars 35 forks source link

Panic in OS X #6

Closed tioover closed 9 years ago

tioover commented 9 years ago
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: CompilationError("ERROR: 0:2: \'\' :  version \'110\' is not supported\nERROR: 0:3: \'\' :  #version required and missing.\nERROR: 0:4: \'attribute\' : syntax error: syntax error\n")', ../src/libcore/result.rs:731

https://github.com/tomaka/glium_text/blob/master/src/lib.rs#L226

Need add 140 version shader:

#version 140

uniform mat4 matrix;
in vec2 position;
in vec2 tex_coords;

out vec2 v_tex_coords;

void main() {
    gl_Position = matrix * vec4(position, 0.0, 1.0);
    v_tex_coords = tex_coords;
}

and

#version 140
in vec2 v_tex_coords;
out vec4 f_color;
uniform vec4 color;
uniform sampler2D tex;
void main() {
    f_color = vec4(color.rgb, color.a * texture(tex, v_tex_coords));
    if (f_color.a <= 0.01) {
        discard;
    }
}