2013-12-22 14:04:33 +00:00
|
|
|
#include "OpenGLSharedState.h"
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
OpenGLSharedState::OpenGLSharedState() {
|
2013-12-22 14:04:33 +00:00
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
void OpenGLSharedState::apply(OpenGLShaderProgram *program, int &texture_unit) {
|
|
|
|
for (const auto &pair : variables) {
|
2013-12-22 17:05:11 +00:00
|
|
|
pair.second->apply(program, texture_unit);
|
2013-12-22 14:04:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
OpenGLVariable *OpenGLSharedState::get(const std::string &name) {
|
|
|
|
OpenGLVariable *&var = variables[name];
|
|
|
|
if (var == 0) {
|
2013-12-22 14:04:33 +00:00
|
|
|
var = new OpenGLVariable(name);
|
|
|
|
}
|
|
|
|
return var;
|
|
|
|
}
|