3 This file is part of libmspgl
4 Copyright © 2007-2008, 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GL_EXTENSION_H_
9 #define MSP_GL_EXTENSION_H_
11 #include <msp/core/except.h>
22 typedef void ExtFunc();
25 Indicates whether an extension is supported. If this returns true, the
26 functions of that extension are safe to use.
28 bool is_supported(const std::string &);
31 Checks that an extension is supported and throws if it isn't.
33 void require_extension(const std::string &);
36 RAII version of require_extension. Useful as a static local variable.
38 struct RequireExtension
40 RequireExtension(const std::string &e) { require_extension(e); }
44 Returns the OpenGL version number, as reported by the implementation.
45 Functions up to the returned version are safe to use.
47 const Version &get_gl_version();
50 Indicates whether the OpenGL version is at least a.b.
52 bool is_version_at_least(unsigned a, unsigned b);
55 Checks that the OpenGL version is at least a.b and throws if it isn't.
57 void require_version(unsigned a, unsigned b);
60 RAII version of require_version. Useful as a static local variable.
64 RequireVersion(unsigned a, unsigned b) { require_version(a, b); }
68 Returns the address of an extension function. Only indended for internal use.
70 ExtFunc *get_proc_address(const std::string &);