From c6edb9c7d15843e8ab965d365099ace29e2d2049 Mon Sep 17 00:00:00 2001 From: Jere Tuliniemi Date: Mon, 1 Apr 2019 15:08:11 +0300 Subject: Add distance field rendering to OpenGL runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old text rendering remains in the background and is used to render clipped text, since that feature is not yet implemented for distance field fonts. Building the runtime with Qt version older than 5.12.2 also causes a fallback to the old text rendering. Depth pass rendering also needs to be redone in the future to avoid another full render pass. Task-number: QT3DS-3210 Change-Id: Ib7666c437d23ae25e1872682f010df3721476a14 Reviewed-by: Tomi Korpipää --- src/Runtime/res/effectlib/distancefieldtext_core.frag | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/Runtime/res/effectlib/distancefieldtext_core.frag (limited to 'src/Runtime/res/effectlib/distancefieldtext_core.frag') diff --git a/src/Runtime/res/effectlib/distancefieldtext_core.frag b/src/Runtime/res/effectlib/distancefieldtext_core.frag new file mode 100644 index 00000000..0f848bc1 --- /dev/null +++ b/src/Runtime/res/effectlib/distancefieldtext_core.frag @@ -0,0 +1,14 @@ +in vec2 sampleCoord; + +out vec4 fragColor; + +uniform sampler2D _qt_texture; +uniform vec4 color; + +in vec2 alphas; + +void main() +{ + fragColor = color * smoothstep(alphas.x, alphas.y, + texture(_qt_texture, sampleCoord).r); +} -- cgit v1.2.3