OGLplus (0.52.0) a C++ wrapper for OpenGL

viewport.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_CONTEXT_VIEWPORT_1201040722_HPP
14 #define OGLPLUS_CONTEXT_VIEWPORT_1201040722_HPP
15 
16 #include <oglplus/glfunc.hpp>
17 
18 namespace oglplus {
19 namespace context {
20 
23 {
24  // private implementation detail, do not use
25  GLfloat _v[2];
26 
28  GLfloat X(void) const
29  {
30  return _v[0];
31  }
32 
34  GLfloat Y(void) const
35  {
36  return _v[1];
37  }
38 };
39 
42 {
43  // private implementation detail, do not use
44  GLfloat _v[2];
45 
47  GLfloat Width(void) const
48  {
49  return _v[0];
50  }
51 
53  GLfloat Height(void) const
54  {
55  return _v[1];
56  }
57 };
58 
61 {
62  // private implementation detail, do not use
63  GLfloat _v[4];
64 
66  GLfloat X(void) const
67  {
68  return _v[0];
69  }
70 
72  GLfloat Y(void) const
73  {
74  return _v[1];
75  }
76 
78  GLfloat Width(void) const
79  {
80  return _v[2];
81  }
82 
84  GLfloat Height(void) const
85  {
86  return _v[3];
87  }
88 };
89 
92 {
93  // private implementation detail, do not use
94  GLfloat _v[2];
95 
97  GLfloat Min(void) const
98  {
99  return _v[0];
100  }
101 
103  GLfloat Max(void) const
104  {
105  return _v[1];
106  }
107 };
108 
111 {
112  // private implementation detail, do not use
113  GLfloat _v[2];
114 
116  GLfloat Near(void) const
117  {
118  return _v[0];
119  }
120 
122  GLfloat Far(void) const
123  {
124  return _v[1];
125  }
126 };
127 
129 
133 {
134 public:
136 
142  static void Viewport(GLint x, GLint y, GLsizei w, GLsizei h)
143  {
144  OGLPLUS_GLFUNC(Viewport)(x, y, w, h);
145  OGLPLUS_CHECK_SIMPLE(Viewport);
146  }
147 
149 
155  static void Viewport(GLsizei w, GLsizei h)
156  {
157  OGLPLUS_GLFUNC(Viewport)(0, 0, w, h);
158  OGLPLUS_CHECK_SIMPLE(Viewport);
159  }
160 
162 
170  {
171  ViewportExtents result;
172  OGLPLUS_GLFUNC(GetFloatv)(GL_VIEWPORT, result._v);
173  OGLPLUS_CHECK_SIMPLE(GetFloatv);
174  return result;
175  }
176 
177 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_1 || GL_ARB_viewport_array
178 
187  {
188  BoundsRange result;
189  OGLPLUS_GLFUNC(GetFloatv)(
190  GL_VIEWPORT_BOUNDS_RANGE,
191  result._v
192  );
193  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
194  return result;
195  }
196 #endif
197 
199 
207  {
208  ViewportSize result;
209  OGLPLUS_GLFUNC(GetFloatv)(
210  GL_MAX_VIEWPORT_DIMS,
211  result._v
212  );
213  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
214  return result;
215  }
216 
217 
218 #if OGLPLUS_DOCUMENTATION_ONLY || \
219  GL_ES_VERSION_3_0 || \
220  GL_VERSION_4_1 || \
221  GL_ARB_ES2_compatibility
222 
229  static void DepthRange(GLclampf near_val, GLclampf far_val)
230  {
231  OGLPLUS_GLFUNC(DepthRangef)(near_val, far_val);
232  OGLPLUS_CHECK_SIMPLE(DepthRangef);
233  }
234 #endif
235 
236 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
237 
244  static void DepthRange(GLclampd near_val, GLclampd far_val)
245  {
246  OGLPLUS_GLFUNC(DepthRange)(near_val, far_val);
247  OGLPLUS_CHECK_SIMPLE(DepthRange);
248  }
249 #endif
250 
251 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_1 || GL_ARB_viewport_array
252 
260  static GLuint MaxViewports(void)
261  {
262  GLint result = 0;
263  OGLPLUS_GLFUNC(GetIntegerv)(GL_MAX_VIEWPORTS, &result);
264  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
265  return GLuint(result);
266  }
267 
269 
275  static void Viewport(
276  GLuint viewport,
277  GLfloat x,
278  GLfloat y,
279  GLfloat width,
280  GLfloat height
281  )
282  {
283  OGLPLUS_GLFUNC(ViewportIndexedf)(viewport, x, y, width, height);
284  OGLPLUS_CHECK(
285  ViewportIndexedf,
286  Error,
287  Index(viewport)
288  );
289  }
290 
292 
298  static void Viewport(GLuint viewport, const GLfloat* extents)
299  {
300  OGLPLUS_GLFUNC(ViewportIndexedfv)(viewport, extents);
301  OGLPLUS_CHECK(
302  ViewportIndexedfv,
303  Error,
304  Index(viewport)
305  );
306  }
307 
309 
315  static void ViewportArray(
316  GLuint first,
317  GLsizei count,
318  const GLfloat* extents
319  )
320  {
321  OGLPLUS_GLFUNC(ViewportArrayv)(first, count, extents);
322  OGLPLUS_CHECK_SIMPLE(ViewportArrayv);
323  }
324 
326 
333  static ViewportExtents Viewport(GLuint viewport)
334  {
335  ViewportExtents result;
336  OGLPLUS_GLFUNC(GetFloati_v)(GL_VIEWPORT, viewport, result._v);
337  OGLPLUS_CHECK_SIMPLE(GetFloati_v);
338  return result;
339  }
340 
341 
343 
349  static void DepthRange(GLuint viewport, GLclampd near_val, GLclampd far_val)
350  {
351  OGLPLUS_GLFUNC(DepthRangeIndexed)(viewport, near_val, far_val);
352  OGLPLUS_CHECK(
353  DepthRangeIndexed,
354  Error,
355  Index(viewport)
356  );
357  }
358 
360 
366  static void DepthRangeArray(
367  GLuint first,
368  GLsizei count,
369  const GLclampd *v
370  )
371  {
372  OGLPLUS_GLFUNC(DepthRangeArrayv)(first, count, v);
373  OGLPLUS_CHECK_SIMPLE(DepthRangeArrayv);
374  }
375 
377 
385  {
387  OGLPLUS_GLFUNC(GetFloati_v)(GL_DEPTH_RANGE, viewport,result._v);
388  OGLPLUS_CHECK(
389  GetFloati_v,
390  Error,
391  Index(viewport)
392  );
393  return result;
394  }
395 #endif
396 };
397 
398 } // namespace context
399 } // namespace oglplus
400 
401 #endif // include guard
GLfloat Height(void) const
The height of the viewport.
Definition: viewport.hpp:84
static void DepthRangeArray(GLuint first, GLsizei count, const GLclampd *v)
Sets depth ranges of viewports specified by first and count.
Definition: viewport.hpp:366
static BoundsRange ViewportBoundsRange(void)
Returns the implementation-dependent viewport bounds range.
Definition: viewport.hpp:186
static void Viewport(GLuint viewport, const GLfloat *extents)
Sets the extents of the specified viewport.
Definition: viewport.hpp:298
GLfloat Y(void) const
The y-coordinate.
Definition: viewport.hpp:34
GLfloat Height(void) const
The height of the viewport.
Definition: viewport.hpp:53
static ViewportSize MaxViewportDims(void)
Returns the implementation-dependent maximum viewport dimensions.
Definition: viewport.hpp:206
Helper structure storing position in a 2D viewport.
Definition: viewport.hpp:22
static void DepthRange(GLclampf near_val, GLclampf far_val)
Sets the near_val / far_val depth range of the default viewport.
Definition: viewport.hpp:229
static void Viewport(GLuint viewport, GLfloat x, GLfloat y, GLfloat width, GLfloat height)
Sets the extents of the specified viewport.
Definition: viewport.hpp:275
GLfloat Far(void) const
The far limit.
Definition: viewport.hpp:122
GLfloat Width(void) const
The width of the viewport.
Definition: viewport.hpp:78
GLfloat Y(void) const
The y-coordinate.
Definition: viewport.hpp:72
static void Viewport(GLsizei w, GLsizei h)
Sets the size of the current viewport starting at (0,0)
Definition: viewport.hpp:155
Helper structure storing the min/max bounds range.
Definition: viewport.hpp:91
GLfloat Max(void) const
The max limit.
Definition: viewport.hpp:103
static ViewportExtents Viewport(void)
Returns the extents of the current viewport.
Definition: viewport.hpp:169
GLfloat X(void) const
The x-coordinate.
Definition: viewport.hpp:28
Helper macro for optional checking of availability of GL function.
static GLuint MaxViewports(void)
Returns the number of available viewports.
Definition: viewport.hpp:260
GLfloat Near(void) const
The near limit.
Definition: viewport.hpp:116
Helper structure storing the dimensions of a 2D viewport.
Definition: viewport.hpp:41
static void DepthRange(GLclampd near_val, GLclampd far_val)
Sets the near_val / far_val depth range of the default viewport.
Definition: viewport.hpp:244
Wrapper for the viewport-related operations.
Definition: viewport.hpp:132
static oglplus::context::DepthRange ViewportDepthRange(GLuint viewport)
Returns the depth range of the specified viewport.
Definition: viewport.hpp:384
Helper structure storing the extents of a 2D viewport.
Definition: viewport.hpp:60
static void Viewport(GLint x, GLint y, GLsizei w, GLsizei h)
Sets the extents of the current viewport.
Definition: viewport.hpp:142
Exception class for general OpenGL errors.
Definition: basic.hpp:43
Helper structure storing the near/far depth range.
Definition: viewport.hpp:110
GLfloat Min(void) const
The min limit.
Definition: viewport.hpp:97
static void DepthRange(GLuint viewport, GLclampd near_val, GLclampd far_val)
Sets the near_val / far_val depth range of a viewport.
Definition: viewport.hpp:349
static ViewportExtents Viewport(GLuint viewport)
Returns the extents of the specified viewport.
Definition: viewport.hpp:333
GLfloat X(void) const
The x-coordinate.
Definition: viewport.hpp:66
static void ViewportArray(GLuint first, GLsizei count, const GLfloat *extents)
Sets extents of the viewports specified by first and count.
Definition: viewport.hpp:315
GLfloat Width(void) const
The width of the viewport.
Definition: viewport.hpp:47

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).