diff --git a/libraries/render-utils/src/TextRenderer3D.cpp b/libraries/render-utils/src/TextRenderer3D.cpp index 2f898542b9..5894a2a258 100644 --- a/libraries/render-utils/src/TextRenderer3D.cpp +++ b/libraries/render-utils/src/TextRenderer3D.cpp @@ -429,8 +429,8 @@ void Font3D::drawString(gpu::Batch& batch, float x, float y, const QString& str, setupGPU(); batch.setPipeline(_pipeline); batch.setUniformTexture(_fontLoc, _texture); - batch._glUniform1f(_outlineLoc, (effectType == TextRenderer3D::OUTLINE_EFFECT) ? 1.0f : 0.0f); batch._glUniform4fv(_colorLoc, 1, (const GLfloat*)&color); + batch._glUniform1i(_outlineLoc, (effectType == TextRenderer3D::OUTLINE_EFFECT)); batch.setInputFormat(_format); batch.setInputBuffer(0, _verticesBuffer, 0, _format->getChannels().at(0)._stride); diff --git a/libraries/render-utils/src/sdf_text3D.slf b/libraries/render-utils/src/sdf_text3D.slf index 3980045d08..07ca75237b 100644 --- a/libraries/render-utils/src/sdf_text3D.slf +++ b/libraries/render-utils/src/sdf_text3D.slf @@ -11,7 +11,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html uniform sampler2D Font; -uniform float Outline; +uniform bool Outline; uniform vec4 Color; const float gamma = 2.6; @@ -22,7 +22,7 @@ const float outlineExpansion = 0.2; void main() { // retrieve signed distance float sdf = texture2D(Font, gl_TexCoord[0].xy).g; - if (Outline == 1.0f) { + if (Outline) { if (sdf > interiorCutoff) { sdf = 1.0 - sdf; } else { @@ -31,7 +31,7 @@ void main() { } // perform adaptive anti-aliasing of the edges // The larger we're rendering, the less anti-aliasing we need - float s = smoothing * length(fwidth(gl_TexCoord[0])); + float s = smoothing * length(fwidth(gl_TexCoord[0].xy)); float w = clamp( s, 0.0, 0.5); float a = smoothstep(0.5 - w, 0.5 + w, sdf); @@ -43,5 +43,5 @@ void main() { } // final color - gl_FragColor = vec4(Color.rgb, a); + gl_FragColor = vec4(Color.rgb, Color.a * a); } \ No newline at end of file