OGLplus (0.52.0) a C++ wrapper for OpenGL

extension.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_EXTENSION_1203031825_HPP
14 #define OGLPLUS_EXTENSION_1203031825_HPP
15 
16 #include <oglplus/config/gl.hpp>
17 #include <oglplus/error/basic.hpp>
18 
19 namespace oglplus {
20 
26 void RequireExtension(const GLchar* name, bool available);
27 
28 #if OGLPLUS_USE_GLEW
29 #define OGLPLUS_EXTENSION_AVAILABLE(VENDOR,EXTENSION) (\
30  (GL_ ## VENDOR ## _ ## EXTENSION == GL_TRUE) ||\
31  (GLEW_ ## VENDOR ## _ ## EXTENSION == GL_TRUE) \
32 )
33 #else
34 bool HasExtension(const GLchar* name);
35 #define OGLPLUS_EXTENSION_AVAILABLE(VENDOR,EXTENSION) (\
36  HasExtension("GL_" #VENDOR "_" #EXTENSION) \
37 )
38 #endif
39 
40 #define OGLPLUS_REQUIRE_EXTENSION(VENDOR, EXTENSION) \
41  ::oglplus::RequireExtension( \
42  #VENDOR "_" #EXTENSION, \
43  OGLPLUS_EXTENSION_AVAILABLE(VENDOR, EXTENSION) \
44  )
45 
46 #define OGLPLUS_EXTENSION_CLASS(VENDOR, EXTENSION) \
47  VENDOR ## _ ## EXTENSION(bool throw_if_unavailable = true) \
48  { \
49  if(throw_if_unavailable) \
50  OGLPLUS_REQUIRE_EXTENSION(VENDOR, EXTENSION); \
51  } \
52  static bool Available(void) \
53  { \
54  return OGLPLUS_EXTENSION_AVAILABLE(VENDOR, EXTENSION); \
55  }
56 
58 
72 #define OGLPLUS_HAS_GL_EXT(VENDOR,EXTENSION) \
73  OGLPLUS_EXTENSION_AVAILABLE(VENDOR,EXTENSION)
74 
75 } // namespace oglplus
76 
77 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
78 #include <oglplus/extension.ipp>
79 #endif // OGLPLUS_LINK_LIBRARY
80 
81 #endif // include guard
Declaration of basic OGLplus' exceptions.

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