summaryrefslogtreecommitdiff
path: root/CompizShader/src/shader.h
blob: 113f27d33a71bd51d4d72a468bd2020849d7d393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
 * author: Alexander Lang
 */
#include <compiz/core/core.h>
#include <core/pluginclasshandler.h>
#include <compiz/composite/composite.h>
#include <compiz/opengl/opengl.h>
#include "shader_options.h"

class ShaderScreen :
    public ScreenInterface,
    public CompositeScreenInterface,
    public GLScreenInterface,
    public PluginClassHandler <ShaderScreen, CompScreen>,
    public ShaderOptions
{
    public:

    ShaderScreen (CompScreen *s);
	~ShaderScreen ();

	CompScreen      *screen;
	CompositeScreen *cScreen;
    GLScreen        *gScreen;

    bool initialized;
    GLuint shaderProgram;
    GLuint vertexShader;
    GLuint fragmentShader;

    bool
    queryForShader();
    void
    bindShader();
    void
    unbindShader();
    void
    loadProgram(std::string& vertexShaderPath, std::string& fragmentShaderPath);
    void
    clearShader();
    GLuint
    loadShader(std::string& fileName, GLuint type);
    void
    shaderInit();

	bool
	glPaintOutput (const GLScreenPaintAttrib &,
		       const GLMatrix &, const CompRegion &,
		       CompOutput *, unsigned int);

	void
	glPaintTransformedOutput (const GLScreenPaintAttrib &,
		       		  const GLMatrix &, const CompRegion &,
		       		  CompOutput *, unsigned int);

};

class ShaderPluginVTable :
    public CompPlugin::VTableForScreen<ShaderScreen>
{
    public:

	bool init ();
};