Line | |
---|
1 | /*! |
---|
2 | * @file shader_data.h |
---|
3 | * @brief Definition of the Shader rendering class |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _SHADER_DATA_H |
---|
7 | #define _SHADER_DATA_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | |
---|
11 | #include "shader_types.h" |
---|
12 | #include <vector> |
---|
13 | |
---|
14 | |
---|
15 | // FORWARD DECLARATION |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | //! The ShaderData is a Class-wrapper around the OpenGL Shader Language (GLSL). |
---|
20 | class ShaderData : public BaseObject |
---|
21 | { |
---|
22 | ObjectListDeclaration(ShaderData); |
---|
23 | public: |
---|
24 | ShaderData(const std::string& vertexShaderFile = "", const std::string& fragmentShaderFile = ""); |
---|
25 | virtual ~ShaderData(); |
---|
26 | |
---|
27 | Shaders::Uniform getUniform(const std::string& location) { return Shader::Uniform(this, location); } |
---|
28 | |
---|
29 | GLhandleARB getProgram() const { return this->shaderProgram; } |
---|
30 | GLhandleARB getVertexS() const { return this->vertexShader; } |
---|
31 | GLhandleARB getFragmentS() const { return this->fragmentShader; } |
---|
32 | |
---|
33 | void activateShader(); |
---|
34 | |
---|
35 | void debug() const; |
---|
36 | private: |
---|
37 | void bindShader(const char* name, const float* value, size_t size); |
---|
38 | void linkShaderProgram(); |
---|
39 | bool readShader(const std::string& fileName, std::string& output); |
---|
40 | bool loadShaderProgramm(Shader::Type type, const std::string& fileName); |
---|
41 | void deleteProgram(Shader::Type type); |
---|
42 | |
---|
43 | private: |
---|
44 | std::string fragmentShaderFile; |
---|
45 | std::string vertexShaderFile; |
---|
46 | |
---|
47 | GLhandleARB shaderProgram; |
---|
48 | |
---|
49 | GLhandleARB vertexShader; |
---|
50 | GLhandleARB fragmentShader; |
---|
51 | }; |
---|
52 | |
---|
53 | #endif /* _SHADER_DATA_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.