]> git.tdb.fi Git - libs/gl.git/blob - source/extension.h
Windows compatibility:
[libs/gl.git] / source / extension.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_EXTENSION_H_
9 #define MSP_GL_EXTENSION_H_
10
11 #include <msp/core/except.h>
12
13 namespace Msp {
14 namespace GL {
15
16 struct Version
17 {
18         unsigned short major;
19         unsigned short minor;
20 };
21
22 typedef void ExtFunc();
23
24 /**
25 Indicates whether an extension is supported.  If this returns true, the
26 functions of that extension are safe to use.
27 */
28 bool is_supported(const std::string &);
29
30 /**
31 Returns the OpenGL version number, as reported by the implementation.
32 Functions up to the returned version are safe to use.
33 */
34 const Version &get_gl_version();
35
36 /**
37 Checks that an extension is supported and throws if it isn't.
38 */
39 void require_extension(const std::string &);
40
41 /**
42 Checks that the OpenGL version is at least a.b and throws if it isn't.
43 */
44 void require_version(unsigned a, unsigned b);
45
46 /**
47 Returns the address of an extension function.
48 */
49 ExtFunc *get_proc_address(const std::string &);
50
51 } // namespace GL
52 } // namespace Msp
53
54 #endif