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.
This commit is contained in:
parent
d396ce990b
commit
32adc59e4b
1 changed files with 20 additions and 2 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue