Esempio n. 1
0
void Program::attach(ShaderPtr shader) {
   DEBUG_M("Attaching shader '%d' to program '%d'", shader->getShaderId(), program_id_);
   if(shader == ShaderPtr()) {
      ERROR("Tried to attach NULL shader.");
      return;
   }
   glAttachShader(program_id_, shader->getShaderId());
   shaders_.insert(shader);
}
Esempio n. 2
0
void ShaderProgram::removeShader(const ShaderPtr& shader)
{
    auto it = std::find(m_shaders.begin(), m_shaders.end(), shader);
    if(it == m_shaders.end())
        return;

    glDetachShader(m_programId, shader->getShaderId());
    m_shaders.erase(it);
    m_linked = false;
}
Esempio n. 3
0
bool ShaderProgram::addShader(const ShaderPtr& shader) {
    glAttachShader(m_programId, shader->getShaderId());
    m_linked = false;
    m_shaders.push_back(shader);
    return true;
}