diff --git a/src/osgText/shaders/text_frag.cpp b/src/osgText/shaders/text_frag.cpp index 03661dd92..02c253100 100644 --- a/src/osgText/shaders/text_frag.cpp +++ b/src/osgText/shaders/text_frag.cpp @@ -79,15 +79,15 @@ char text_frag[] = "$OSG_GLSL_VERSION\n" " }\n" " else if (edge_distance>-blend_half_width)\n" " {\n" - " return mix(vertexColor, BACKDROP_COLOR, smoothstep(0.0, 1.0, (blend_half_width-edge_distance)/(blend_width)));\n" + " return mix(vertexColor, vec4(BACKDROP_COLOR.rgb, BACKDROP_COLOR.a*vertexColor.a), smoothstep(0.0, 1.0, (blend_half_width-edge_distance)/(blend_width)));\n" " }\n" " else if (edge_distance>(blend_half_width-outline_width))\n" " {\n" - " return BACKDROP_COLOR;\n" + " return vec4(BACKDROP_COLOR.rgb, BACKDROP_COLOR.a*vertexColor.a);\n" " }\n" " else if (edge_distance>-(outline_width+blend_half_width))\n" " {\n" - " return vec4(BACKDROP_COLOR.rgb, ((blend_half_width+outline_width+edge_distance)/blend_width));\n" + " return vec4(BACKDROP_COLOR.rgb, vertexColor.a * ((blend_half_width+outline_width+edge_distance)/blend_width));\n" " }\n" " else\n" " {\n" @@ -100,7 +100,7 @@ char text_frag[] = "$OSG_GLSL_VERSION\n" " }\n" " else if (edge_distance>-blend_half_width)\n" " {\n" - " return vec4(vertexColor.rgb, smoothstep(1.0, 0.0, (blend_half_width-edge_distance)/(blend_width)));\n" + " return vec4(vertexColor.rgb, vertexColor.a * smoothstep(1.0, 0.0, (blend_half_width-edge_distance)/(blend_width)));\n" " }\n" " else\n" " {\n" @@ -214,7 +214,7 @@ char text_frag[] = "$OSG_GLSL_VERSION\n" " if (outline_alpha==0.0) return vec4(0.0, 0.0, 0.0, 0.0); // outside glyph and outline\n" "\n" " vec4 color = mix(BACKDROP_COLOR, vertexColor, smoothstep(0.0, 1.0, alpha));\n" - " color.a = smoothstep(0.0, 1.0, outline_alpha);\n" + " color.a = vertexColor.a * smoothstep(0.0, 1.0, outline_alpha);\n" "\n" " return color;\n" "\n"