paysages3d/src/render/opengl/OpenGLSharedState.cpp

26 lines
575 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, int &texture_unit) {
for (const auto &pair : variables) {
2013-12-22 17:05:11 +00:00
pair.second->apply(program, texture_unit);
}
}
OpenGLVariable *OpenGLSharedState::get(const std::string &name) {
OpenGLVariable *&var = variables[name];
if (var == NULL) {
var = new OpenGLVariable(name);
}
return var;
}