add get_uniform_location{,s}()

This commit is contained in:
Josh Holtrop 2012-09-03 00:55:45 -04:00
parent ed3b5fa454
commit db3ffa84af
2 changed files with 15 additions and 0 deletions

View File

@ -58,3 +58,16 @@ bool GLProgram::create(const char *v_source, const char *f_source,
return true;
}
GLint GLProgram::get_uniform_location(const char *name)
{
return glGetUniformLocation(m_id, name);
}
void GLProgram::get_uniform_locations(const char **names, int num, GLint *locs)
{
for (int i = 0; i < num; i++)
{
locs[i] = get_uniform_location(names[i]);
}
}

View File

@ -17,6 +17,8 @@ class GLProgram
bool create(const char *v_source, const char *f_source,
AttributeBinding *bindings = NULL);
GLuint get_id() { return m_id; }
GLint get_uniform_location(const char *name);
void get_uniform_locations(const char **names, int num, GLint *locs);
protected:
GLuint m_id;
GLShader m_v_shader;