OGLplus (0.52.0) a C++ wrapper for OpenGL

rasterization.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_CONTEXT_RASTERIZATION_1201040722_HPP
14 #define OGLPLUS_CONTEXT_RASTERIZATION_1201040722_HPP
15 
16 #include <oglplus/glfunc.hpp>
17 #include <oglplus/face_mode.hpp>
18 #include <oglplus/polygon_mode.hpp>
19 #include <oglplus/provoke_mode.hpp>
20 #include <oglplus/math/vector.hpp>
21 
22 namespace oglplus {
23 namespace context {
24 
26 
30 {
31 public:
33 
37  static void FrontFace(FaceOrientation orientation)
38  {
39  OGLPLUS_GLFUNC(FrontFace)(GLenum(orientation));
40  OGLPLUS_VERIFY(
41  FrontFace,
42  Error,
43  EnumParam(orientation)
44  );
45  }
46 
48 
52  static void CullFace(Face mode)
53  {
54  OGLPLUS_GLFUNC(CullFace)(GLenum(mode));
55  OGLPLUS_VERIFY(
56  CullFace,
57  Error,
58  EnumParam(mode)
59  );
60  }
61 
63 
68  static Face CullFaceMode(void)
69  {
70  GLint result;
71  OGLPLUS_GLFUNC(GetIntegerv)(GL_CULL_FACE_MODE, &result);
72  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
73  return Face(result);
74  }
75 
76 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
77 
82  static void PolygonMode(Face face, oglplus::PolygonMode mode)
83  {
84  OGLPLUS_GLFUNC(PolygonMode)(GLenum(face), GLenum(mode));
85  OGLPLUS_VERIFY(
87  Error,
88  EnumParam(mode)
89  );
90  }
91 
93 
98  {
99  OGLPLUS_GLFUNC(PolygonMode)(GL_FRONT_AND_BACK, GLenum(mode));
100  OGLPLUS_VERIFY(
101  PolygonMode,
102  Error,
103  EnumParam(mode)
104  );
105  }
106 
108 
114  {
115  GLint result[2];
116  OGLPLUS_GLFUNC(GetIntegerv)(GL_POLYGON_MODE, result);
117  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
118  return oglplus::PolygonMode(result[1]);
119  }
120 #endif // GL_VERSION_3_0
121 
123 
127  static void PolygonOffset(GLfloat factor, GLfloat units)
128  {
129  OGLPLUS_GLFUNC(PolygonOffset)(factor, units);
130  OGLPLUS_VERIFY_SIMPLE(PolygonOffset);
131  }
132 
134 
139  static GLfloat PolygonOffsetFactor(void)
140  {
141  GLfloat result;
142  OGLPLUS_GLFUNC(GetFloatv)(GL_POLYGON_OFFSET_FACTOR, &result);
143  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
144  return result;
145  }
146 
148 
153  static GLfloat PolygonOffsetUnits(void)
154  {
155  GLfloat result;
156  OGLPLUS_GLFUNC(GetFloatv)(GL_POLYGON_OFFSET_UNITS, &result);
157  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
158  return result;
159  }
160 
162 
166  static void LineWidth(GLfloat width)
167  {
168  OGLPLUS_GLFUNC(LineWidth)(width);
169  OGLPLUS_VERIFY_SIMPLE(LineWidth);
170  }
171 
173 
178  static GLfloat LineWidth(void)
179  {
180  GLfloat result;
181  OGLPLUS_GLFUNC(GetFloatv)(GL_LINE_WIDTH, &result);
182  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
183  return result;
184  }
185 
186 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
187 
192  static void PointSize(GLfloat size)
193  {
194  OGLPLUS_GLFUNC(PointSize)(size);
195  OGLPLUS_VERIFY_SIMPLE(PointSize);
196  }
197 
199 
204  static GLfloat PointSize(void)
205  {
206  GLfloat result;
207  OGLPLUS_GLFUNC(GetFloatv)(GL_POINT_SIZE, &result);
208  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
209  return result;
210  }
211 
213 
218  static void PointFadeThresholdSize(GLfloat size)
219  {
220  OGLPLUS_GLFUNC(PointParameterf)(
221  GL_POINT_FADE_THRESHOLD_SIZE,
222  size
223  );
224  OGLPLUS_VERIFY_SIMPLE(PointParameterf);
225  }
226 
228 
233  static GLfloat PointFadeThresholdSize(void)
234  {
235  GLfloat result;
236  OGLPLUS_GLFUNC(GetFloatv)(GL_POINT_FADE_THRESHOLD_SIZE,&result);
237  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
238  return result;
239  }
240 #endif // GL_VERSION_3_0
241 
242 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_2 || GL_ARB_provoking_vertex
243 
249  static void ProvokingVertex(ProvokeMode mode)
250  {
251  OGLPLUS_GLFUNC(ProvokingVertex)(GLenum(mode));
252  OGLPLUS_VERIFY_SIMPLE(ProvokingVertex);
253  }
254 
256 
263  {
264  GLint result;
265  OGLPLUS_GLFUNC(GetIntegerv)(GL_PROVOKING_VERTEX, &result);
266  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
267  return ProvokeMode(result);
268  }
269 #endif
270 
276  static GLint SampleBuffers(void)
277  {
278  GLint result;
279  OGLPLUS_GLFUNC(GetIntegerv)(GL_SAMPLE_BUFFERS, &result);
280  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
281  return result;
282  }
283 
285 
290  static GLint Samples(void)
291  {
292  GLint result;
293  OGLPLUS_GLFUNC(GetIntegerv)(GL_SAMPLES, &result);
294  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
295  return result;
296  }
297 
298 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_2
299 
306  static Vec2f SamplePosition(GLuint index)
307  {
308  Vec2f result;
309  OGLPLUS_GLFUNC(GetMultisamplefv)(
310  GL_SAMPLE_POSITION,
311  index,
312  result.Data()
313  );
314  OGLPLUS_VERIFY_SIMPLE(GetMultisamplefv);
315  return result;
316  }
317 #endif
318 
319 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_0
320 
327  static GLfloat MinSampleShading(void)
328  {
329  GLfloat result;
330  OGLPLUS_GLFUNC(GetFloatv)(GL_MIN_SAMPLE_SHADING_VALUE, &result);
331  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
332  return result;
333  }
334 
336 
341  static void MinSampleShading(GLfloat value)
342  {
343  OGLPLUS_GLFUNC(MinSampleShading)(value);
344  OGLPLUS_VERIFY_SIMPLE(MinSampleShading);
345  }
346 #endif
347 };
348 
349 } // namespace context
350 } // namespace oglplus
351 
352 #endif // include guard
static Vec2f SamplePosition(GLuint index)
Returns the position of the specified multisampling sample.
Definition: rasterization.hpp:306
static GLfloat LineWidth(void)
Returns the line width.
Definition: rasterization.hpp:178
static GLfloat PointFadeThresholdSize(void)
Returns the point fade threshold size.
Definition: rasterization.hpp:233
static GLint SampleBuffers(void)
Returns the value of sample buffers.
Definition: rasterization.hpp:276
static void PolygonOffset(GLfloat factor, GLfloat units)
Sets the polygon depth offset.
Definition: rasterization.hpp:127
static void PolygonMode(oglplus::PolygonMode mode)
Sets the polygon rasterization mode.
Definition: rasterization.hpp:97
static void PolygonMode(Face face, oglplus::PolygonMode mode)
Sets the polygon rasterization mode.
Definition: rasterization.hpp:82
static void FrontFace(FaceOrientation orientation)
Sets the polygon facing mode.
Definition: rasterization.hpp:37
OpenGL provoking vertex mode enumeration.
static Face CullFaceMode(void)
Returns the face culling mode.
Definition: rasterization.hpp:68
static GLfloat PointSize(void)
Returns the point size.
Definition: rasterization.hpp:204
ProvokeMode
Provoking vertex selection mode (for flatshading) enumeration.
Definition: provoke_mode.hpp:27
static oglplus::PolygonMode PolygonMode(void)
Returns the face culling mode.
Definition: rasterization.hpp:113
Face
Polygon facing enumeration.
Definition: face_mode.hpp:34
FaceOrientation
Face orientation enumeration.
Definition: face_mode.hpp:62
OpenGL face type-related enumeration.
static GLint Samples(void)
Returns the number of multisampling samples.
Definition: rasterization.hpp:290
Helper macro for optional checking of availability of GL function.
static void ProvokingVertex(ProvokeMode mode)
Sets the provoking vertex selection mode for flatshading.
Definition: rasterization.hpp:249
static GLfloat MinSampleShading(void)
Returns the minimal sample shading value.
Definition: rasterization.hpp:327
friend const T * Data(const Vector &vector)
Returns a pointer to an array containing the vectors coordinates.
Definition: vector.hpp:356
PolygonMode
Polygon rasterization mode enumeration.
Definition: polygon_mode.hpp:27
static void CullFace(Face mode)
Sets the face culling mode.
Definition: rasterization.hpp:52
static void PointSize(GLfloat size)
Sets the point size.
Definition: rasterization.hpp:192
static ProvokeMode ProvokingVertex(void)
Returns the provoking vertex selection mode for flatshading.
Definition: rasterization.hpp:262
Exception class for general OpenGL errors.
Definition: basic.hpp:43
OpenGL polygon rasterization mode-related enumeration.
static GLfloat PolygonOffsetUnits(void)
Returns the polygon offset units.
Definition: rasterization.hpp:153
static void LineWidth(GLfloat width)
Sets the line width.
Definition: rasterization.hpp:166
Wrapper for the basic point, line and polygon rasterization operations.
Definition: rasterization.hpp:29
Basic template for vector types.
Definition: fwd.hpp:43
static void MinSampleShading(GLfloat value)
Sets the multisampling minimal sample shading value.
Definition: rasterization.hpp:341
A vector class.
static GLfloat PolygonOffsetFactor(void)
Returns the polygon offset factor.
Definition: rasterization.hpp:139
static void PointFadeThresholdSize(GLfloat size)
Sets the point fade threshold size.
Definition: rasterization.hpp:218

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).