OGLplus (0.52.0) a C++ wrapper for OpenGL

limit_queries.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_CONTEXT_LIMIT_QUERIES_1201040722_HPP
14 #define OGLPLUS_CONTEXT_LIMIT_QUERIES_1201040722_HPP
15 
16 #include <oglplus/glfunc.hpp>
17 #include <oglplus/limit_query.hpp>
18 
19 namespace oglplus {
20 namespace context {
21 
23 
27 {
28 public:
30 
34  static GLint IntLimit(LimitQuery query)
35  {
36  GLint result = 0;
37  OGLPLUS_GLFUNC(GetIntegerv)(GLenum(query), &result);
38  OGLPLUS_VERIFY_SIMPLE(GetIntegerv);
39  return result;
40  }
41 
43 
47  static GLint IntLimit(LimitQuery query, GLuint index)
48  {
49  GLint result = 0;
50  OGLPLUS_GLFUNC(GetIntegeri_v)(GLenum(query), index, &result);
51  OGLPLUS_VERIFY_SIMPLE(GetIntegeri_v);
52  return result;
53  }
54 
56 
60  static GLfloat FloatLimit(LimitQuery query)
61  {
62  GLfloat result = 0;
63  OGLPLUS_GLFUNC(GetFloatv)(GLenum(query), &result);
64  OGLPLUS_VERIFY_SIMPLE(GetFloatv);
65  return result;
66  }
67 
68 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_1 || GL_ARB_viewport_array
69 
74  static GLfloat FloatLimit(LimitQuery query, GLuint index)
75  {
76  GLfloat result = 0;
77  OGLPLUS_GLFUNC(GetFloati_v)(GLenum(query), index, &result);
78  OGLPLUS_VERIFY_SIMPLE(GetFloati_v);
79  return result;
80  }
81 #endif
82 
83  static void ThrowIfOverLimit(
84  LimitQuery limit,
85  GLint value,
86  GLint max_limit
87  )
88  {
89  OGLPLUS_HANDLE_ERROR_IF(
90  value > max_limit,
91  GL_INVALID_VALUE,
92  LimitError::Message(),
93  LimitError,
94  GLFunc(EnumValueName(limit).c_str())
95  );
96  }
97 
99 
105  static void RequireAtLeast(LimitQuery limit, GLint value)
106  {
107  ThrowIfOverLimit(limit, value, IntLimit(limit));
108  }
109 
111 
117  static void RequireAtLeast(LimitQuery limit, GLuint index, GLint value)
118  {
119  ThrowIfOverLimit(limit, value, IntLimit(limit, index));
120  }
121 };
122 
123 } // namespace context
124 } // namespace oglplus
125 
126 #endif // include guard
static GLint IntLimit(LimitQuery query)
Gets the implementation-dependent limit value.
Definition: limit_queries.hpp:34
Exception indicating exceeded implementation-defined limits.
Definition: limit.hpp:30
StrCRef EnumValueName(Enum enum_value)
Returns the name of the GL enumerated value for an OGLplus enum value.
static void RequireAtLeast(LimitQuery limit, GLuint index, GLint value)
Raises a LimitError if value is greater than the specified limit.
Definition: limit_queries.hpp:117
LimitQuery
Enumeration of implementation-dependent limit queries.
Definition: limit_query.hpp:27
Wrapper for implementation-dependent limit queries.
Definition: limit_queries.hpp:26
Helper macro for optional checking of availability of GL function.
static GLfloat FloatLimit(LimitQuery query)
Gets the implementation-dependent limit value.
Definition: limit_queries.hpp:60
static void RequireAtLeast(LimitQuery limit, GLint value)
Raises a LimitError if value is greater than the specified limit.
Definition: limit_queries.hpp:105
OpenGL min/max implementation-dependent limit queries.
static GLfloat FloatLimit(LimitQuery query, GLuint index)
Gets the implementation-dependent indexed limit value.
Definition: limit_queries.hpp:74
static GLint IntLimit(LimitQuery query, GLuint index)
Gets the implementation-dependent indexed limit value.
Definition: limit_queries.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).