From d3365c5c725e8876e0cb4bf82f8fee49ddea67d8 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Tue, 20 Sep 2016 16:12:50 +0200 Subject: [PATCH] OpenGL: fix GPU_SHADER_TEXT on non-Mac Developed on Mac and committed quickly.. oops --- .../blender/gpu/shaders/gpu_shader_text_frag.glsl | 15 +++++++++++---- .../blender/gpu/shaders/gpu_shader_text_vert.glsl | 10 +++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) 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() {