Carna Version 3.3.3
Loading...
Searching...
No Matches
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>
17#include <memory>
18
23namespace Carna
24{
25
26namespace base
27{
28
29
30
31// ----------------------------------------------------------------------------------
32// RenderState
33// ----------------------------------------------------------------------------------
34
85class CARNA_LIB RenderState
86{
87
89
90 struct Details;
91 const std::unique_ptr< Details > pimpl;
92
93protected:
94
95 friend class GLContext;
96
100 explicit RenderState( GLContext& glContext );
101
105 void commit() const;
106
107public:
108
113 {
114
119
124
128 cullFront
129
130 }; // CullFace
131
137
142
146 void setDepthTest( bool dt );
147
151 void setDepthWrite( bool dw );
152
160
165 void setBlend( bool b );
166
174
178 void setBlendEquation( int be );
179
184
189 void setFrontFace( bool ccw );
190
196 void setPointSize( float pointSize );
197
198private:
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
Represents an association.
Definition Association.h:45
Defines how alpha blending is to be performed.
Wraps and represents an OpenGL context.
Definition GLContext.h:63
Manages the OpenGL render state.
Definition RenderState.h:86
CullFace
Lists supported face culling modes.
@ cullNone
All polygons will pass the cull test.
@ cullBack
Polygons recognized as back-faces will be discarded.
void commit() const
Commits the full state. For internal usage only.
RenderState()
Derives new render state from the current one of the current OpenGL context.
RenderState(GLContext &glContext)
Creates the root instance of glContext. For internal usage only.
void setBlendFunction(const BlendFunction &bf)
Configures how alpha blending is to be done. Alpha blending only applies if it is activated....
void setDepthWrite(bool dw)
Enables or disables depth writing.
void setDepthTestFunction(int dtf)
Configures how the depth test is to be performed. Depth test only applies if it is activated....
~RenderState()
Restores previous render state.
void setCullFace(CullFace cf)
Configures face culling. Also see setFrontFace.
void setFrontFace(bool ccw)
Sets whether front faces are winded contra-clockwise. Also see setCullFace.
void setBlend(bool b)
Enables or disables alpha blending. Alpha blending is configured through setBlendFunction and setBlen...
void setPointSize(float pointSize)
Sets glPointSize to pointSize if point size is non-negative. Enables GL_PROGRAM_POINT_SIZE and leaves...
void setDepthTest(bool dt)
Enables or disables depth testing.
void setBlendEquation(int be)
Sets glBlendEquation to be.
#define NON_COPYABLE
Features class it is placed in as non-copyable.