Adusted Font shaders to use gl3 path on gles3, iphone example using inbuilt shaders

This commit is contained in:
Thomas Hogarth
2017-03-20 19:35:01 +00:00
parent b493657c47
commit 630af80635
4 changed files with 115 additions and 624 deletions

View File

@@ -35,13 +35,22 @@ using namespace std;
static osg::ApplicationUsageProxy Font_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_TEXT_INCREMENTAL_SUBLOADING <type>","ON | OFF");
#define FIXED_FUNCTION defined(OSG_GL_FIXED_FUNCTION_AVAILABLE)
#define SHADERS_GL3 (defined(OSG_GL3_AVAILABLE))
#define SHADERS_GL3 (defined(OSG_GL3_AVAILABLE) || defined(OSG_GLES3_AVAILABLE))
#define SHADERS_GL2 !FIXED_FUNCTION && !SHADERS_GL3
#define IS_ES (defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE))
#if SHADERS_GL3
#if !IS_ES
#define GLSL_VERSION_STR "330 core"
#define GLYPH_CMP "r"
#else
#define GLSL_VERSION_STR "300 es"
#define GLYPH_CMP "a"
#endif
static const char* gl3_TextVertexShader = {
"#version 330 core\n"
"#version " GLSL_VERSION_STR "\n"
"// gl3_TextVertexShader\n"
"#ifdef GL_ES\n"
" precision highp float;\n"
@@ -61,7 +70,7 @@ static const char* gl3_TextVertexShader = {
};
static const char* gl3_TextFragmentShader = {
"#version 330 core\n"
"#version " GLSL_VERSION_STR "\n"
"// gl3_TextFragmentShader\n"
"#ifdef GL_ES\n"
" precision highp float;\n"
@@ -72,7 +81,7 @@ static const char* gl3_TextFragmentShader = {
"out vec4 color;\n"
"void main(void)\n"
"{\n"
" if (texCoord.x>=0.0) color = vertexColor * vec4(1.0, 1.0, 1.0, texture(glyphTexture, texCoord).r);\n"
" if (texCoord.x>=0.0) color = vertexColor * vec4(1.0, 1.0, 1.0, texture(glyphTexture, texCoord)." GLYPH_CMP ");\n"
" else color = vertexColor;\n"
"}\n"
};