paysages3d/src/render/opengl/OpenGLSharedState.cpp

31 lines
732 B
C++
Raw Normal View History

#include "OpenGLSharedState.h"
OpenGLSharedState::OpenGLSharedState() {
}
OpenGLSharedState::~OpenGLSharedState() {
for (const auto &pair : variables) {
delete pair.second;
}
}
void OpenGLSharedState::apply(OpenGLShaderProgram *program, unsigned int &texture_unit) {
for (const auto &pair : variables) {
2013-12-22 17:05:11 +00:00
pair.second->apply(program, texture_unit);
}
}
void OpenGLSharedState::destroy(OpenGLFunctions *functions) {
for (const auto &pair : variables) {
pair.second->destroy(functions);
}
}
2015-12-10 23:36:50 +00:00
OpenGLVariable *OpenGLSharedState::get(const string &name) {
OpenGLVariable *&var = variables[name];
if (var == NULL) {
var = new OpenGLVariable(name);
}
return var;
}