Carna  Version 3.3.2
RenderState.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 RENDERSTATE_H_6014714286
13 #define RENDERSTATE_H_6014714286
14 
15 #include <Carna/Carna.h>
16 #include <Carna/base/noncopyable.h>
17 #include <memory>
18 
23 namespace Carna
24 {
25 
26 namespace base
27 {
28 
29 
30 
31 // ----------------------------------------------------------------------------------
32 // RenderState
33 // ----------------------------------------------------------------------------------
34 
85 class CARNA_LIB RenderState
86 {
87 
89 
90  struct Details;
91  const std::unique_ptr< Details > pimpl;
92 
93 protected:
94 
95  friend class GLContext;
96 
100  explicit RenderState( GLContext& glContext );
101 
105  void commit() const;
106 
107 public:
108 
112  enum CullFace
113  {
114 
119 
124 
128  cullFront
129 
130  }; // CullFace
131 
136  RenderState();
137 
141  ~RenderState();
142 
146  void setDepthTest( bool dt );
147 
151  void setDepthWrite( bool dw );
152 
159  void setDepthTestFunction( int dtf );
160 
165  void setBlend( bool b );
166 
173  void setBlendFunction( const BlendFunction& bf );
174 
178  void setBlendEquation( int be );
179 
183  void setCullFace( CullFace cf );
184 
189  void setFrontFace( bool ccw );
190 
196  void setPointSize( float pointSize );
197 
198 private:
199 
200  void commitDepthTest() const;
201 
202  void commitDepthWrite() const;
203 
204  void commitDepthTestFunction() const;
205 
206  void commitBlend() const;
207 
208  void commitBlendFunction() const;
209 
210  void commitBlendEquation() const;
211 
212  void commitCullFace() const;
213 
214  void commitFrontFace() const;
215 
216  void commitPointSize() const;
217 
218 }; // RenderState
219 
220 
221 
222 } // namespace Carna :: base
223 
224 } // namespace Carna
225 
226 #endif // RENDERSTATE_H_6014714286
CullFace
Lists supported face culling modes.
Definition: RenderState.h:112
Manages the OpenGL render state.
Definition: RenderState.h:85
All polygons will pass the cull test.
Definition: RenderState.h:118
Polygons recognized as back-faces will be discarded.
Definition: RenderState.h:123
Defines how alpha blending is to be performed.
Definition: BlendFunction.h:39
Wraps and represents an OpenGL context.
Definition: GLContext.h:62
#define NON_COPYABLE
Features class it is placed in as non-copyable.
Definition: noncopyable.h:109