FastUIDraw
gl_get.hpp
Go to the documentation of this file.
1 /*!
2  * \file gl_get.hpp
3  * \brief file gl_get.hpp
4  *
5  * Adapted from: WRATHglGet.hpp of WRATH:
6  *
7  * Copyright 2013 by Nomovok Ltd.
8  * Contact: info@nomovok.com
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@nomovok.com>
16  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
17  *
18  */
19 
20 
21 #ifndef FASTUIDRAW_GL_GET_HPP
22 #define FASTUIDRAW_GL_GET_HPP
23 
24 
26 #include <fastuidraw/util/vecN.hpp>
27 
28 namespace fastuidraw {
29 namespace gl {
30 
31 /*!\addtogroup GLUtility
32  * @{
33  */
34 
35 
36 /*!
37  * Overloaded C++ version of glGet* family
38  * of functions in GL. Equivalent to
39  * glGetInteger(v, ptr).
40  * \param v GL enumeration to fetch
41  * \param ptr address to which to write values
42  */
43 void
44 context_get(GLenum v, GLint *ptr);
45 
46 /*!
47  * Overloaded C++ version of glGet* family
48  * of functions in GL. Equivalent to
49  * glGetBooleanv(v, ptr).
50  * \param v GL enumeration to fetch
51  * \param ptr address to which to write values
52  */
53 void
54 context_get(GLenum v, GLboolean *ptr);
55 
56 /*!
57  * Overloaded C++ version of glGet* family
58  * of functions in GL. Equivalent to
59  * glGetBooleanv(v, ptr).
60  * \param v GL enumeration to fetch
61  * \param ptr address to which to write values
62  */
63 void
64 context_get(GLenum v, bool *ptr);
65 
66 /*!
67  * Overloaded C++ version of glGet* family
68  * of functions in GL. Equivalent to
69  * glGetFloatv(v, ptr).
70  * \param v GL enumeration to fetch
71  * \param ptr address to which to write values
72  */
73 void
74 context_get(GLenum v, GLfloat *ptr);
75 
76 /*!
77  * Overloaded C++ version of glGet* family
78  * of functions in GL, accepting the address
79  * of a vecN, by rules of template recursion,
80  * can take vecN's of other types.
81  * \param v GL enumeration to fetch
82  * \param p address to which to write values
83  */
84 template<typename T, size_t N>
85 void
86 context_get(GLenum v, vecN<T,N> *p)
87 {
88  context_get(v, p->c_ptr());
89 }
90 
91 
92 /*!
93  * Overloaded C++ version of glGet* family of functions in GL. The
94  * template parameter determines what glGet function is called.
95  * The return value is initialized as 0 before calling glGet(),
96  * thus if the GL implementation does not support that enum, the
97  * return value is 0.
98  * \param value GL enumeration to fetch
99  */
100 template<typename T>
101 T
102 context_get(GLenum value)
103 {
104  T return_value(0);
105  context_get(value, &return_value);
106  return return_value;
107 }
108 /*! @} */
109 
110 
111 } //namespace gl
112 } //namespace fastuidraw
113 
114 #endif
void context_get(GLenum v, GLint *ptr)
T * c_ptr(void)
Definition: vecN.hpp:400
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
file gl_header.hpp
vecN is a simple static array class with no virtual functions and no memory overhead. Supports runtim array index checking and STL style iterators via pointer iterators.
Definition: vecN.hpp:42
file vecN.hpp