2022-06-30 12:39:10 +02:00
|
|
|
#include "Shader.hpp"
|
|
|
|
|
|
|
|
GLint CShader::getUniformLocation(const std::string& unif) {
|
|
|
|
const auto itpos = m_muUniforms.find(unif);
|
|
|
|
|
|
|
|
if (itpos == m_muUniforms.end()) {
|
|
|
|
const auto unifLoc = glGetUniformLocation(program, unif.c_str());
|
|
|
|
m_muUniforms[unif] = unifLoc;
|
|
|
|
return unifLoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return itpos->second;
|
2022-08-11 20:33:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CShader::~CShader() {
|
|
|
|
// destroy shader
|
2022-12-01 14:36:07 +01:00
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CShader::destroy() {
|
2022-11-01 19:46:51 +01:00
|
|
|
glDeleteProgram(program);
|
2022-12-03 15:45:05 +01:00
|
|
|
|
|
|
|
program = 0;
|
2022-06-30 12:39:10 +02:00
|
|
|
}
|