Commit: e21853abb9fee9936f0a2d257a5b110535f0937e
Author: Mike Erwin
Date:   Sat Sep 17 13:54:30 2016 +0200
Branches: blender2.8
https://developer.blender.org/rBe21853abb9fee9936f0a2d257a5b110535f0937e

OpenGL: streamline font rendering

Ignore texture matrix in the shader, stop messing with texture matrix in BLF 
code.

Use linear screen-space interpolation instead of perspective.

Avoid redundant call to glMatrixMode.

===================================================================

M       source/blender/blenfont/intern/blf.c
M       source/blender/gpu/shaders/gpu_shader_text_frag.glsl
M       source/blender/gpu/shaders/gpu_shader_text_vert.glsl

===================================================================

diff --git a/source/blender/blenfont/intern/blf.c 
b/source/blender/blenfont/intern/blf.c
index ec1f3d1..d7fcb2c 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -507,11 +507,8 @@ static void blf_draw_gl__start(FontBLF *font, GLint *mode)
        /* Save the current matrix mode. */
        glGetIntegerv(GL_MATRIX_MODE, mode);
 
-       glMatrixMode(GL_TEXTURE);
-       glPushMatrix();
-       glLoadIdentity();
-
-       glMatrixMode(GL_MODELVIEW);
+       if (*mode != GL_MODELVIEW)
+               glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
 
        if (font->flags & BLF_MATRIX)
@@ -534,10 +531,6 @@ static void blf_draw_gl__start(FontBLF *font, GLint *mode)
 
 static void blf_draw_gl__end(GLint mode)
 {
-       glMatrixMode(GL_TEXTURE);
-       glPopMatrix();
-
-       glMatrixMode(GL_MODELVIEW);
        glPopMatrix();
 
        if (mode != GL_MODELVIEW)
diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl 
b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
index 4869a63..c8c90d8 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
@@ -1,6 +1,6 @@
 
 flat varying vec4 color;
-varying vec2 texcoord;
+noperspective varying vec2 texcoord;
 
 uniform sampler2D glyph;
 
diff --git a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl 
b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
index 8449c42..7247940 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
@@ -5,12 +5,12 @@
 // - generic attrib inputs (2D pos, tex coord)
 
 flat varying vec4 color;
-varying vec2 texcoord;
+noperspective varying vec2 texcoord;
 
 void main()
 {
        gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
 
        color = gl_Color;
-       texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
+       texcoord = gl_MultiTexCoord0.st;
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to