Carna  Version 3.0.1
ShaderProgram.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef SHADERPROGRAM_H_6014714286
13 #define SHADERPROGRAM_H_6014714286
14 
22 #include <Carna/base/math.h>
23 #include <Carna/base/noncopyable.h>
24 #include <stack>
25 
26 namespace Carna
27 {
28 
29 namespace base
30 {
31 
32 
33 
34 // ----------------------------------------------------------------------------------
35 // ShaderProgram
36 // ----------------------------------------------------------------------------------
37 
47 class CARNA_LIB ShaderProgram
48 {
49 
51 
52  ShaderProgram();
53 
54 public:
55 
56  // ------------------------------------------------------------------------------
57  // ShaderProgram :: Factory
58  // ------------------------------------------------------------------------------
59 
66  class Factory
67  {
68 
70 
71  struct Details;
72  const std::unique_ptr< Details > pimpl;
73 
74  public:
75 
79  Factory();
80 
84  ~Factory();
85 
90  void setVertexShader ( const Shader& shader );
91 
96  void setGeometryShader( const Shader& shader );
97 
102  void setFragmentShader( const Shader& shader );
103 
111  ShaderProgram* create() const;
112 
113  }; // ShaderProgram :: Factory
114 
115  // ------------------------------------------------------------------------------
116 
120  virtual ~ShaderProgram();
121 
125  const unsigned int id;
126 
127 private:
128 
132  void checkErrors() const;
133 
134 }; // ShaderProgram
135 
136 
137 
138 } // namespace Carna :: base
139 
140 } // namespace Carna
141 
142 #endif // SHADERPROGRAM_H_6014714286
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Creates OpenGL shader program.
Definition: ShaderProgram.h:66
const unsigned int id
Holds the shader program ID.
Maintains an OpenGL shader program. Realizes the RAII-idiom.
Definition: ShaderProgram.h:47
Maintains an OpenGL shader object. Realizes the RAII-idiom.
Definition: Shader.h:47
#define NON_COPYABLE
Features class it is placed in as non-copyable.
Definition: noncopyable.h:109