reset custom cube shaders on screen change

the reset/setup invokes the viewport dimensions...

BUG: 323311
FIXED-IN: 4.11.1
REVIEW: 112133
This commit is contained in:
Thomas Lübking 2013-08-17 16:46:46 +02:00
parent 809d261067
commit 9001af8e5a
4 changed files with 26 additions and 0 deletions

View file

@ -122,6 +122,7 @@ CubeEffect::CubeEffect()
connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int)));
connect(effects, SIGNAL(tabBoxClosed()), this, SLOT(slotTabBoxClosed()));
connect(effects, SIGNAL(tabBoxUpdated()), this, SLOT(slotTabBoxUpdated()));
connect(effects, SIGNAL(screenGeometryChanged(const QSize&)), this, SLOT(slotResetShaders()));
reconfigure(ReconfigureAll);
}
@ -290,6 +291,14 @@ void CubeEffect::slotWallPaperLoaded()
watcher->deleteLater();
}
void CubeEffect::slotResetShaders()
{
ShaderManager::instance()->resetShader(m_capShader, ShaderManager::GenericShader);
ShaderManager::instance()->resetShader(m_reflectionShader, ShaderManager::GenericShader);
ShaderManager::instance()->resetShader(cylinderShader, ShaderManager::GenericShader);
ShaderManager::instance()->resetShader(sphereShader, ShaderManager::GenericShader);
}
bool CubeEffect::loadShader()
{
if (!(GLPlatform::instance()->supports(GLSL) &&

View file

@ -139,6 +139,7 @@ private slots:
void slotTabBoxClosed();
void slotCubeCapLoaded();
void slotWallPaperLoaded();
void slotResetShaders();
private:
enum RotationDirection {
Left,

View file

@ -787,6 +787,16 @@ void ShaderManager::resetAllShaders()
}
}
void ShaderManager::resetShader(GLShader *shader, ShaderType type)
{
if (!(shader && shader->isValid()))
return;
pushShader(shader);
resetShader(type);
popShader();
}
void ShaderManager::pushShader(GLShader *shader)
{

View file

@ -352,6 +352,12 @@ public:
**/
void resetAllShaders();
/**
* Resets ShaderType @p type uniforms of a custom shader
* @since 4.11.1
*/
void resetShader(GLShader *shader, ShaderType type);
/**
* Creates a GLShader with a built-in vertex shader and a custom fragment shader.
* @param vertex The generic vertex shader