aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render/Shader.cpp
blob: 03b13055dcf11a062024019db96b36f962f4eae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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;
}

CShader::~CShader() {
    // destroy shader
    destroy();

    program = 0;
}

void CShader::destroy() {
    glDeleteProgram(program);
}