From 32adc59e4b14e324514f9407ea63e5087359665c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 1 May 2011 11:24:46 +0200 Subject: [PATCH] Use cap shader to render area between screens in cube This fixes most of the rendering issues with cube in multi screen setups and GLSL backend. For cylinder and sphere the rendering of areas between screen is currently disabled if using the GLSL backend. It needs adjustments to use another vertex shader. Not sure if it is worth the effort. --- effects/cube/cube.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 31c1e69d1a..bdc76de41f 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -1503,14 +1503,32 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa } } } + bool capShader = false; + if (ShaderManager::instance()->isValid() && m_capShader->isValid()) { + capShader = true; + ShaderManager::instance()->pushShader(m_capShader); + m_capShader->setUniform("u_mirror", 0); + m_capShader->setUniform("u_untextured", 1); + if (reflectionPainting) { + m_capShader->setUniform("screenTransformation", m_reflectionMatrix * m_rotationMatrix * origMatrix); + } else { + m_capShader->setUniform("screenTransformation", m_rotationMatrix * origMatrix); + } + m_capShader->setUniform("windowTransformation", QMatrix4x4()); + } GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); vbo->reset(); QColor color = capColor; capColor.setAlphaF(cubeOpacity); - // TODO: use sphere and cylinder shaders vbo->setColor(color); vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); - vbo->render(GL_TRIANGLES); + if (!capShader || mode == Cube) { + // TODO: use sphere and cylinder shaders + vbo->render(GL_TRIANGLES); + } + if (capShader) { + ShaderManager::instance()->popShader(); + } glDisable(GL_BLEND); #ifndef KWIN_HAVE_OPENGLES glPopAttrib();