Pyrogenesis  trunk
opengl.h
Go to the documentation of this file.
1 /* Copyright (c) 2011 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * bring in OpenGL header+library, with compatibility fixes
25  */
26 
27 #ifndef INCLUDED_OPENGL
28 #define INCLUDED_OPENGL
29 
30 #include "lib/config2.h" // CONFIG2_GLES
31 
32 #if OS_WIN
33 // wgl.h is a private header and should only be included from here.
34 // if this isn't defined, it'll complain.
35 #define WGL_HEADER_NEEDED
36 #include "lib/sysdep/os/win/wgl.h"
37 #endif
38 
39 #if CONFIG2_GLES
40 # include <GLES2/gl2.h>
41 #elif OS_MACOSX || OS_MAC
42 # include <OpenGL/gl.h>
43 #else
44 # include <GL/gl.h>
45 #endif
46 
47 // if gl.h provides real prototypes for 1.2 / 1.3 functions,
48 // exclude the corresponding function pointers in glext_funcs.h
49 #ifdef GL_VERSION_1_2
50 #define REAL_GL_1_2
51 #endif
52 #ifdef GL_VERSION_1_3
53 #define REAL_GL_1_3
54 #endif
55 
56 // this must come after GL/gl.h include, so we can't combine the
57 // including GL/glext.h.
58 #undef GL_GLEXT_PROTOTYPES
59 
60 #if CONFIG2_GLES
61 # include <GLES2/gl2ext.h>
62 #elif OS_MACOSX || OS_MAC
63 # include <OpenGL/glext.h>
64 #else
65 # include <GL/glext.h>
66 # if OS_WIN
67 # include <GL/wglext.h>
68 # endif
69 #endif
70 
71 #endif // #ifndef INCLUDED_OPENGL