Created
April 9, 2012 21:18
-
-
Save shakesoda/2346610 to your computer and use it in GitHub Desktop.
uniform setter thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Uniform | |
{ | |
public: | |
// todo: macroify, make m_program actually a thing. | |
void set_uniform_float(std::string key, float data) | |
{ | |
using namespace std; | |
unsigned location = 0; | |
map<string, unsigned>::iterator it; | |
it = m_uniforms.find(key); | |
if (it == m_uniforms.end()) | |
m_uniforms[key] = glGetUniformLocation(m_program, key.c_str()); | |
glUniform1f(location, data); | |
} | |
private: | |
std::map<std::string, unsigned> m_uniforms; | |
unsigned m_program; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment