Updated text_sdf.frag shader to handle GLES2+ versions

This commit is contained in:
Robert Osfield
2017-09-20 11:02:06 +01:00
parent 420094174e
commit b0829cc352

View File

@@ -1,19 +1,23 @@
char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
"$OSG_PRECISION_FLOAT\n"
"\n"
"#pragma import_defines( BACKDROP_COLOR, OUTLINE )\n"
"\n"
"#if __VERSION__>=400\n"
" #define osg_TextureQueryLOD textureQueryLod\n"
" #define USE_SIGNED_DISTNACE_FIELD\n"
"#else\n"
" #extension GL_ARB_texture_query_lod : enable\n"
" #ifdef GL_ARB_texture_query_lod\n"
" #define osg_TextureQueryLOD textureQueryLOD\n"
"#if !defined(GL_ES)\n"
" #if __VERSION__>=400\n"
" #define osg_TextureQueryLOD textureQueryLod\n"
" #define USE_SIGNED_DISTNACE_FIELD\n"
" #else\n"
" #extension GL_ARB_texture_query_lod : enable\n"
" #ifdef GL_ARB_texture_query_lod\n"
" #define osg_TextureQueryLOD textureQueryLOD\n"
" #define USE_SIGNED_DISTNACE_FIELD\n"
" #endif\n"
" #endif\n"
"#endif\n"
"\n"
"\n"
"$OSG_PRECISION_FLOAT\n"
"\n"
"//#undef USE_SIGNED_DISTNACE_FIELD\n"
"\n"
"#if __VERSION__>=130\n"
@@ -35,7 +39,7 @@ char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
" // glyph.rgba = (signed_distance, thin_outline, thick_outline, glyph_alpha)\n"
" vec4 glyph = TEXTURE(glyphTexture, texCoord);\n"
"\n"
" #if 0\n"
" #if 1\n"
" float blend_ratio = OUTLINE*17.0;\n"
"\n"
" float outline_alpha = 0.0;\n"