void VideoDriverGLES20::setShaderProgram(ShaderProgram* prog_) { CHECKGL(); ShaderProgramGL* prog = safeCast<ShaderProgramGL*>(prog_); unsigned int id = prog->getID(); glUseProgram(id); _program = id; int gl_error = glGetError(); if (gl_error != GL_NO_ERROR) { log::error("OpenGL error: %#x\n", gl_error); char buf[1024]; GLsizei len; glGetProgramInfoLog(id, sizeof(buf)-1, &len, buf); buf[len] = 0; log::error("OpenGL error: %s\n", buf); if (gl_error == GL_OUT_OF_MEMORY) { exit(0); } } // CHECKGL(); }
void VideoDriverGLES20::setShaderProgram(ShaderProgram* prog_) { CHECKGL(); ShaderProgramGL* prog = safeCast<ShaderProgramGL*>(prog_); unsigned int id = prog->getID(); oxglUseProgram(id); _program = id; CHECKGL(); }
void OutputShaderError(const ShaderProgramGL& shaderProgram) { #ifdef _WIN32 int i=0; const char* error_msg; while( (error_msg = shaderProgram.getErrorMsg(i)) != NULL ) { MessageBox(NULL, error_msg, "Error", 0); i++; } #endif }
SceneShaderInfo InitShaderInfo(const ShaderProgramGL& program) { return SceneShaderInfo( program.getVariableLocation("modelMatrix"), program.getVariableLocation("projModelViewMatrix"), program.getVariableLocation("normalMatrix"), program.getVariableLocation("materialAmbient"), program.getVariableLocation("materialDiffuse"), program.getVariableLocation("materialSpecular"), program.getVariableLocation("materialShininess"), program.getVariableLocation("lightAmbient"), program.getVariableLocation("lightDiffuse"), program.getVariableLocation("lightSpecular"), program.getVariableLocation("lightPosition")); }