Commit 1c746807 authored by Thomas Lübking's avatar Thomas Lübking
Browse files

reset custom cube shaders on screen change

the reset/setup invokes the viewport dimensions...

BUG: 323311
FIXED-IN: 4.11.1
REVIEW: 112133
parent af6653c7
......@@ -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) &&
......
......@@ -139,6 +139,7 @@ private slots:
void slotTabBoxClosed();
void slotCubeCapLoaded();
void slotWallPaperLoaded();
void slotResetShaders();
private:
enum RotationDirection {
Left,
......
......@@ -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)
{
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment