Combine custom vertex with built-in fragment shader.
This commit is contained in:
parent
8c4fc28e1a
commit
36daa74589
2 changed files with 29 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue