bool GLProgram::removeShader(ShaderPtr shader) { if (!m_shaders.contains(shader)) return false; disconnect(shader.get(), SIGNAL(changed(ShaderPtr)), this, SIGNAL(shaderChanged(ShaderPtr))); m_shaders.remove(shader); if (m_prog) glRun(glDetachShader(m_prog, shader->id())); shader->setProgram(ProgramPtr()); m_compiled = false; m_relink = true; emit changed(); return true; }
void GLProgram::addShader(ShaderPtr shader) { if (!shader->program()) shader->setProgram(shared_from_this()); assert(shader->program() == shared_from_this()); assert(!m_shaders.contains(shader)); m_shaders << shader; connect(shader.get(), SIGNAL(changed(ShaderPtr)), this, SIGNAL(shaderChanged(ShaderPtr))); emit changed(); }