add get_uniform_location{,s}()
This commit is contained in:
parent
ed3b5fa454
commit
db3ffa84af
@ -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]);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user