31 m_shaderType = shaderType;
34 m_shaderId = glCreateShader(GL_VERTEX_SHADER);
37 m_shaderId = glCreateShader(GL_FRAGMENT_SHADER);
51 glDeleteShader(m_shaderId);
57 static const char *qualifierDefines =
62 static const char *qualifierDefines =
63 "#ifndef GL_FRAGMENT_PRECISION_HIGH\n"
64 "#define highp mediump\n"
66 "precision highp float;\n";
69 std::string code = qualifierDefines;
70 code.append(sourceCode);
71 const char *c_source = code.c_str();
72 glShaderSource(m_shaderId, 1, &c_source,
nullptr);
73 glCompileShader(m_shaderId);
76 glGetShaderiv(m_shaderId, GL_COMPILE_STATUS, &res);
77 return (res == GL_TRUE);
94 int infoLogLength = 0;
95 glGetShaderiv(m_shaderId, GL_INFO_LOG_LENGTH, &infoLogLength);
96 if(infoLogLength > 1) {
97 std::vector<char> buf(infoLogLength);
98 glGetShaderInfoLog(m_shaderId, infoLogLength-1,
nullptr, &buf[0]);