FastUIDraw
gl_context_properties.hpp
Go to the documentation of this file.
1 /*!
2  * \file gl_context_properties.hpp
3  * \brief file gl_context_properties.hpp
4  *
5  * Copyright 2016 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
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@gmail.com>
16  *
17  */
18 
19 
20 #ifndef FASTUIDRAW_GL_CONTEXT_PROPERTIES_HPP
21 #define FASTUIDRAW_GL_CONTEXT_PROPERTIES_HPP
22 
23 #include <fastuidraw/util/util.hpp>
24 #include <fastuidraw/util/vecN.hpp>
25 
26 namespace fastuidraw
27 {
28  namespace gl
29  {
30 
31 /*!\addtogroup GLUtility
32  * @{
33  */
34 
35  /*!
36  * \brief
37  * A ContextProperties provides an interface to
38  * query GL/GLES version and extensions.
39  */
41  {
42  public:
43  /*!
44  * Ctor.
45  * \param make_ready if true, query GL context at ctor (instead of lazily)
46  * to generate GL context information
47  */
48  explicit
49  ContextProperties(bool make_ready = false);
50 
52 
53  /*!
54  * Return the GL/GLES version of the GL context
55  * with the major version in [0] and the minor
56  * version in [1].
57  */
59  version(void) const;
60 
61  /*!
62  * Returns the GL major version, equivalent to
63  * \code
64  * version()[0]
65  * \endcode
66  */
67  int
68  major_version(void) const
69  {
70  return version()[0];
71  }
72 
73  /*!
74  * Returns the GL minor version, equivalent to
75  * \code
76  * version()[1]
77  * \endcode
78  */
79  int
80  minor_version(void) const
81  {
82  return version()[1];
83  }
84 
85  /*!
86  * Returns true if the context is OpenGL ES,
87  * returns value if the context is OpenGL.
88  */
89  bool
90  is_es(void) const;
91 
92  /*!
93  * Returns true if the context supports the named
94  * extension.
95  */
96  bool
97  has_extension(c_string ext) const;
98 
99  private:
100  void *m_d;
101  };
102 /*! @} */
103  }
104 }
105 
106 #endif
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
bool has_extension(c_string ext) const
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
vecN< int, 2 > version(void) const
file util.hpp
file vecN.hpp
const char * c_string
Conveniant typedef for C-style strings.
Definition: util.hpp:135
Class for which copy ctor and assignment operator are private functions.
Definition: util.hpp:505
A ContextProperties provides an interface to query GL/GLES version and extensions.
ContextProperties(bool make_ready=false)