Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Shader::setParameter(const std::string& name, float* x, int c = 1)
- {
- if (m_shaderProgram)
- {
- ensureGlContext();
- // Enable program
- GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
- glCheck(glUseProgramObjectARB(m_shaderProgram));
- // Get parameter location and assign it new values
- GLint location = glGetUniformLocationARB(m_shaderProgram, name.c_str());
- if (location != -1)
- glCheck(glUniformMatrix4fvARB(location, c, GL_FALSE, x));
- else
- err() << "Parameter \"" << name << "\" not found in shader" << std::endl;
- // Disable program
- glCheck(glUseProgramObjectARB(program));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement