diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl index c8c90d8bf09..c169b315c24 100644 --- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl @@ -1,14 +1,21 @@ -flat varying vec4 color; -noperspective varying vec2 texcoord; +#if __VERSION__ == 120 + flat varying vec4 color; + noperspective varying vec2 texcoord; + #define fragColor gl_FragColor +#else + flat in vec4 color; + noperspective in vec2 texcoord; + out vec4 fragColor; +#endif uniform sampler2D glyph; void main() { // input color replaces texture color - gl_FragColor.rgb = color.rgb; + fragColor.rgb = color.rgb; // modulate input alpha & texture alpha - gl_FragColor.a = color.a * texture2D(glyph, texcoord).a; + fragColor.a = color.a * texture2D(glyph, texcoord).a; } diff --git a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl index 72479401568..bdbffdfcf51 100644 --- a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl @@ -1,11 +1,15 @@ // TODO(merwin): -// - use modern GLSL // - uniform color, not per vertex // - generic attrib inputs (2D pos, tex coord) -flat varying vec4 color; -noperspective varying vec2 texcoord; +#if __VERSION__ == 120 + flat varying vec4 color; + noperspective varying vec2 texcoord; +#else + flat out vec4 color; + noperspective out vec2 texcoord; +#endif void main() {