diff options
author | Joe Wilm <joe@jwilm.com> | 2016-05-20 21:36:28 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-05-20 21:36:28 -0700 |
commit | c70acbac0b721ea2f1b1442898c22aee0f360ef2 (patch) | |
tree | a78722cbabb59c59e7dacc02a4c4d05405839dea /src/renderer | |
parent | e794bc11b962adef4d6fbbaeb85344cb138376da (diff) | |
download | alacritty-c70acbac0b721ea2f1b1442898c22aee0f360ef2.tar.gz alacritty-c70acbac0b721ea2f1b1442898c22aee0f360ef2.zip |
Correct sub-pixel font rendering with OpenGL
Uses the GL_ARB_blend_func_extended to get single-pass, per-channel
alpha blending. gl_generator is now used instead of gl to enable the
extension.
The background color is removed since that presumably needs to run in a
separate pass.
Diffstat (limited to 'src/renderer')
-rw-r--r-- | src/renderer/mod.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 001cb40f..4666981b 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -96,8 +96,7 @@ impl QuadRenderer { self.program.activate(); unsafe { // set color - gl::Uniform3f(self.program.u_color, 1., 1., 0.5); - gl::Uniform3f(self.program.u_bg_color, 0.08, 0.08, 0.08); + gl::Uniform3f(self.program.u_color, 0.917, 0.917, 0.917); } let rect = get_rect(glyph, x, y); @@ -153,8 +152,6 @@ pub struct ShaderProgram { u_projection: GLint, /// color uniform u_color: GLint, - /// background color uniform - u_bg_color: GLint, } impl ShaderProgram { @@ -183,13 +180,11 @@ impl ShaderProgram { // get uniform locations let projection_str = CString::new("projection").unwrap(); let color_str = CString::new("textColor").unwrap(); - let bg_color_str = CString::new("bgColor").unwrap(); - let (projection, color, bg_color) = unsafe { + let (projection, color) = unsafe { ( gl::GetUniformLocation(program, projection_str.as_ptr()), gl::GetUniformLocation(program, color_str.as_ptr()), - gl::GetUniformLocation(program, bg_color_str.as_ptr()), ) }; @@ -197,14 +192,11 @@ impl ShaderProgram { assert!(projection != gl::INVALID_OPERATION as i32); assert!(color != gl::INVALID_VALUE as i32); assert!(color != gl::INVALID_OPERATION as i32); - assert!(bg_color != gl::INVALID_VALUE as i32); - assert!(bg_color != gl::INVALID_OPERATION as i32); let shader = ShaderProgram { id: program, u_projection: projection, u_color: color, - u_bg_color: bg_color, }; // set projection uniform |