From 2bee9a0ee08291b5d57db20faf2fe1d959c77f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 21 May 2013 08:43:51 +0200 Subject: [PATCH] Use generic fragment shader for Cylinder and Sphere Shaders were broken. Issue mentioned in the TODO seems to no longer be present (at least not on the system I used for testing). REVIEW: 110570 --- effects/cube/CMakeLists.txt | 1 - effects/cube/cube.cpp | 9 +++------ effects/cube/data/cylinder.frag | 20 -------------------- 3 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 effects/cube/data/cylinder.frag diff --git a/effects/cube/CMakeLists.txt b/effects/cube/CMakeLists.txt index d30612a617..647142f716 100644 --- a/effects/cube/CMakeLists.txt +++ b/effects/cube/CMakeLists.txt @@ -24,7 +24,6 @@ install( FILES cube/data/cube-cap.glsl cube/data/cube-reflection.glsl cube/data/cubecap.png - cube/data/cylinder.frag cube/data/cylinder.vert cube/data/sphere.vert DESTINATION ${DATA_INSTALL_DIR}/kwin ) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 02fb4a4f5e..271c4e9d93 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -283,16 +283,14 @@ bool CubeEffect::loadShader() if (!(GLPlatform::instance()->supports(GLSL) && (effects->compositingType() == OpenGL2Compositing))) return false; - QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag"); QString cylinderVertexshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.vert"); QString sphereVertexshader = KGlobal::dirs()->findResource("data", "kwin/sphere.vert"); - if (fragmentshader.isEmpty() || cylinderVertexshader.isEmpty() || sphereVertexshader.isEmpty()) { + if (cylinderVertexshader.isEmpty() || sphereVertexshader.isEmpty()) { kError(1212) << "Couldn't locate shader files" << endl; return false; } - // TODO: use generic shader - currently it is failing in alpha/brightness manipulation - cylinderShader = new GLShader(cylinderVertexshader, fragmentshader); + cylinderShader = ShaderManager::instance()->loadVertexShader(ShaderManager::GenericShader, cylinderVertexshader); if (!cylinderShader->isValid()) { kError(1212) << "The cylinder shader failed to load!" << endl; return false; @@ -321,8 +319,7 @@ bool CubeEffect::loadShader() QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); cylinderShader->setUniform("width", (float)rect.width() * 0.5f); } - // TODO: use generic shader - currently it is failing in alpha/brightness manipulation - sphereShader = new GLShader(sphereVertexshader, fragmentshader); + sphereShader = ShaderManager::instance()->loadVertexShader(ShaderManager::GenericShader, sphereVertexshader); if (!sphereShader->isValid()) { kError(1212) << "The sphere shader failed to load!" << endl; return false; diff --git a/effects/cube/data/cylinder.frag b/effects/cube/data/cylinder.frag deleted file mode 100644 index d7594c317d..0000000000 --- a/effects/cube/data/cylinder.frag +++ /dev/null @@ -1,20 +0,0 @@ -uniform sampler2D sampler; -uniform float opacity; -uniform float brightness; -uniform float saturation; - -varying vec2 varyingTexCoords; - -void main() -{ - vec4 tex = texture2D(sampler, varyingTexCoords); - if( saturation != 1.0 ) - { - vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 ); - desaturated = vec3( dot( desaturated, tex.rgb )); - tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation ); - } -// tex.rgb = tex.rgb * opacity * brightness; -// tex.a = tex.a * opacity; - gl_FragColor = tex; -}