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); }
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; }
bool ShaderProgram::addShader(const ShaderPtr& shader) { glAttachShader(m_programId, shader->getShaderId()); m_linked = false; m_shaders.push_back(shader); return true; }