|
From: | Nicolas Rougier |
Subject: | Re: [ft-devel] [ANN] Freetype/OpenGL (with good rendering quality) |
Date: | Wed, 21 Sep 2011 18:51:01 +0200 |
Thanks for the tips, I'll give it a try. One problem is that glyphs are loaded on demand and consequently I do not have full control. The subpixel positionning is made using a shader. I display the glyph at a given integer coordinate and send along the float component: If glyph must be displayed at coordinate x=5.4, I display it at x=5 and send m=.4 to the shader. Then depending on m ( 0-.33, .33-.66 and .66-.99), I make a combination with previous pixel for each color channel: // current pixel as r,g,b,a vec4 current = texture2D(texture, uv); // prevous pixel as r,g,b,a vec4 previous= texture2D(texture, uv+vec2(-1,0)*pixel); float r = current.r; float g = current.g; float b = current.b; float a = current.a; if( m <= 0.333 ) { float z = m/0.333; r = mix(current.r, previous.b, z); g = mix(current.g, current.r, z); b = mix(current.b, current.g, z); } else if( m <= 0.666 ) { float z = (m-0.33)/0.333; r = mix(previous.b, previous.g, z); g = mix(current.r, previous.b, z); b = mix(current.g, current.r, z); } else if( m < 1.0 ) { float z = (m-0.66)/0.334; r = mix(previous.g, previous.r, z); g = mix(previous.b, previous.g, z); b = mix(current.r, previous.b, z); } Final color is then r, g, b, a. I compared with direct freetype rendering but obtained small differences. Nicolas On Sep 21, 2011, at 18:07 , Alexei Podtelezhnikov wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |