fix shaders for OpenGL ES

This commit is contained in:
Eduardo Bart
2011-12-07 00:09:44 -02:00
parent f89bc352d5
commit b37a34219d
2 changed files with 21 additions and 10 deletions

View File

@@ -45,7 +45,21 @@ Shader::~Shader()
bool Shader::compileSourceCode(const std::string& sourceCode)
{
const char *c_source = sourceCode.c_str();
#ifndef OPENGL_ES2
static const char *qualifierDefines =
"#define lowp\n"
"#define mediump\n"
"#define highp\n";
#else
static const char *qualifierDefines =
"#ifndef GL_FRAGMENT_PRECISION_HIGH\n"
"#define highp mediump\n"
"#endif\n";
#endif
std::string code = qualifierDefines;
code.append(sourceCode);
const char *c_source = code.c_str();
glShaderSource(m_shaderId, 1, &c_source, NULL);
glCompileShader(m_shaderId);