Commit 81f5706f authored by Martin Flöser's avatar Martin Flöser

Combine custom vertex with built-in fragment shader.

parent 08f4191a
......@@ -1303,6 +1303,28 @@ GLShader *ShaderManager::loadFragmentShader(ShaderType vertex, const QString &fr
return shader;
}
GLShader *ShaderManager::loadVertexShader(ShaderType fragment, const QString &vertexFile)
{
QString fragmentShader;
switch (fragment) {
// Simple and Generic Shader use same fragment Shader
case SimpleShader:
case GenericShader:
fragmentShader = ":/resources/scene-fragment.glsl";
break;
case ColorShader:
fragmentShader = ":/resources/scene-color-fragment.glsl";
break;
}
GLShader *shader = new GLShader(vertexFile, fragmentShader);
if (shader->isValid()) {
pushShader(shader);
resetShader(fragment);
popShader();
}
return shader;
}
GLShader *ShaderManager::loadShaderFromCode(const QString &vertexSource, const QString &fragmentSource)
{
GLShader *shader = new GLShader();
......
......@@ -422,6 +422,13 @@ class KWIN_EXPORT ShaderManager
* @return The created shader
**/
GLShader *loadFragmentShader(ShaderType vertex, const QString &fragmentFile);
/**
* Creates a GLShader with a built-in fragment shader and a custom vertex shader.
* @param fragment The generic fragment shader
* @param vertexFile The path to the source code of the vertex shader
* @return The created shader
**/
GLShader *loadVertexShader(ShaderType fragment, const QString &vertexFile);
/**
* Creates a GLShader with the specified sources.
* The difference to GLShader is that it does not need to be loaded from files.
......
Markdown is supported
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