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/main.rs | |
parent | e794bc11b962adef4d6fbbaeb85344cb138376da (diff) | |
download | r-alacritty-c70acbac0b721ea2f1b1442898c22aee0f360ef2.tar.gz r-alacritty-c70acbac0b721ea2f1b1442898c22aee0f360ef2.tar.bz2 r-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/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 48aaf11b..ef025bea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ extern crate fontconfig; extern crate freetype; extern crate libc; extern crate glutin; -extern crate gl; extern crate cgmath; extern crate euclid; @@ -17,6 +16,10 @@ use renderer::{Glyph, QuadRenderer}; use text::FontDesc; use grid::Grid; +mod gl { + include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); +} + static INIT_LIST: &'static str = "abcdefghijklmnopqrstuvwxyz\ ABCDEFGHIJKLMNOPQRSTUVWXYZ\ 01234567890\ @@ -37,7 +40,7 @@ fn main() { let (dpi_x, dpi_y) = window.get_dpi().unwrap(); let dpr = window.hidpi_factor(); - let font_size = 11.0; + let font_size = 11.; let sep_x = 2; let sep_y = 5; @@ -92,8 +95,8 @@ fn main() { } unsafe { - // gl::Enable(gl::BLEND); - // gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); + gl::Enable(gl::BLEND); + gl::BlendFunc(gl::SRC1_COLOR, gl::ONE_MINUS_SRC1_COLOR); gl::Enable(gl::MULTISAMPLE); } @@ -101,7 +104,7 @@ fn main() { for event in window.wait_events() { unsafe { - gl::ClearColor(0.08, 0.08, 0.08, 1.0); + gl::ClearColor(0.0, 0.0, 0.00, 1.0); gl::Clear(gl::COLOR_BUFFER_BIT); } |