Michaël Lemaire
4a710c0977
Conflicts: src/interface/commandline/tests.cpp src/render/opengl/OpenGLPart.h src/render/opengl/OpenGLRenderer.cpp src/render/opengl/OpenGLRenderer.h src/render/opengl/OpenGLShaderProgram.h src/render/opengl/OpenGLSharedState.h src/render/software/SoftwareCanvasRenderer.h
31 lines
723 B
C++
31 lines
723 B
C++
#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) {
|
|
pair.second->apply(program, texture_unit);
|
|
}
|
|
}
|
|
|
|
void OpenGLSharedState::destroy(OpenGLFunctions *functions) {
|
|
for (const auto &pair : variables) {
|
|
pair.second->destroy(functions);
|
|
}
|
|
}
|
|
|
|
OpenGLVariable *OpenGLSharedState::get(const string &name) {
|
|
OpenGLVariable *&var = variables[name];
|
|
if (var == NULL) {
|
|
var = new OpenGLVariable(name);
|
|
}
|
|
return var;
|
|
}
|