tennis.map: Texture tweak
[neverball] / share / glext.h
1 /*
2  * Copyright (C) 2003-2011 Neverball authors
3  *
4  * NEVERBALL is  free software; you can redistribute  it and/or modify
5  * it under the  terms of the GNU General  Public License as published
6  * by the Free  Software Foundation; either version 2  of the License,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
11  * MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
12  * General Public License for more details.
13  */
14
15 #ifndef GLEXT_H
16 #define GLEXT_H
17
18 /*---------------------------------------------------------------------------*/
19 /* Include the system OpenGL headers.                                        */
20
21 #ifdef _WIN32
22 #define WIN32_LEAN_AND_MEAN
23 #include <windows.h>
24 #endif
25
26 #ifdef __APPLE__
27 #include <OpenGL/gl.h>
28 #else
29 #include <GL/gl.h>
30 #endif
31
32 #ifdef _WIN32
33 #include <GL/glext.h>
34 #endif
35
36 /*---------------------------------------------------------------------------*/
37
38 #ifndef GL_MULTISAMPLE
39 #define GL_MULTISAMPLE                0x809D
40 #endif
41
42 #ifndef GL_TEXTURE0
43 #define GL_TEXTURE0                   0x84C0
44 #endif
45
46 #ifndef GL_TEXTURE1
47 #define GL_TEXTURE1                   0x84C1
48 #endif
49
50 #ifndef GL_TEXTURE2
51 #define GL_TEXTURE2                   0x84C2
52 #endif
53
54 #ifndef GL_ARRAY_BUFFER
55 #define GL_ARRAY_BUFFER               0x8892
56 #endif
57
58 #ifndef GL_ELEMENT_ARRAY_BUFFER
59 #define GL_ELEMENT_ARRAY_BUFFER       0x8893
60 #endif
61
62 #ifndef GL_STATC_DRAW
63 #define GL_STATIC_DRAW                0x88E4
64 #endif
65
66 #ifndef GL_DYNAMIC_DRAW
67 #define GL_DYNAMIC_DRAW               0x88E8
68 #endif
69
70 #ifndef GL_POINT_SPRITE
71 #define GL_POINT_SPRITE               0x8861
72 #endif
73
74 #ifndef GL_COORD_REPLACE
75 #define GL_COORD_REPLACE              0x8862
76 #endif
77
78 #ifndef GL_POINT_DISTANCE_ATTENUATIAN
79 #define GL_POINT_DISTANCE_ATTENUATION 0x8129
80 #endif
81
82 /*---------------------------------------------------------------------------*/
83
84 int glext_check(const char *);
85 int glext_init(void);
86
87 /*---------------------------------------------------------------------------*/
88
89 /* Exercise extreme paranoia in defining a cross-platform OpenGL interface.  */
90 /* If we're compiling against OpenGL ES then we must assume native linkage   */
91 /* of the extensions we use. Otherwise, GetProc them regardless of whether   */
92 /* they need it or not.                                                      */
93
94 #if defined(GL_VERSION_ES_CM_1_0) || \
95     defined(GL_VERSION_ES_CM_1_1) || \
96     defined(GL_OES_VERSION_1_0)
97
98 #define ENABLE_OPENGLES 1
99
100 #define glClientActiveTexture_ glClientActiveTexture
101 #define glActiveTexture_       glActiveTexture
102 #define glGenBuffers_          glGenBuffers
103 #define glBindBuffer_          glBindBuffer
104 #define glBufferData_          glBufferData
105 #define glBufferSubData_       glBufferSubData
106 #define glDeleteBuffers_       glDeleteBuffers
107 #define glIsBuffer_            glIsBuffer
108 #define glPointParameterfv_    glPointParameterfv
109
110 #define glOrtho_               glOrthof
111
112 #else /* No native linkage?  Define the extension API. */
113
114 #define glOrtho_               glOrtho
115
116 /*---------------------------------------------------------------------------*/
117 /* ARB_multitexture                                                          */
118
119 typedef void (*PFNGLACTIVETEXTURE_PROC)(GLenum);
120 typedef void (*PFNGLCLIENTACTIVETEXTURE_PROC)(GLenum);
121
122 extern PFNGLCLIENTACTIVETEXTURE_PROC glClientActiveTexture_;
123 extern PFNGLACTIVETEXTURE_PROC       glActiveTexture_;
124
125 /*---------------------------------------------------------------------------*/
126 /* ARB_vertex_buffer_object                                                  */
127
128 typedef void      (*PFNGLGENBUFFERS_PROC)(GLsizei, GLuint *);
129 typedef void      (*PFNGLBINDBUFFER_PROC)(GLenum, GLuint);
130 typedef void      (*PFNGLBUFFERDATA_PROC)(GLenum, GLsizeiptr, const GLvoid *, GLenum);
131 typedef void      (*PFNGLBUFFERSUBDATA_PROC)(GLenum, GLintptr, GLsizeiptr, const GLvoid *);
132 typedef void      (*PFNGLDELETEBUFFERS_PROC)(GLsizei, const GLuint *);
133 typedef GLboolean (*PFNGLISBUFFER_PROC)(GLuint);
134
135 extern PFNGLGENBUFFERS_PROC    glGenBuffers_;
136 extern PFNGLBINDBUFFER_PROC    glBindBuffer_;
137 extern PFNGLBUFFERDATA_PROC    glBufferData_;
138 extern PFNGLBUFFERSUBDATA_PROC glBufferSubData_;
139 extern PFNGLDELETEBUFFERS_PROC glDeleteBuffers_;
140 extern PFNGLISBUFFER_PROC      glIsBuffer_;
141
142 /*---------------------------------------------------------------------------*/
143 /* ARB_point_parameters                                                      */
144
145 typedef void (*PFNGLPOINTPARAMETERFV_PROC)(GLenum, const GLfloat *);
146
147 extern PFNGLPOINTPARAMETERFV_PROC glPointParameterfv_;
148
149 /*---------------------------------------------------------------------------*/
150 #endif /* !ENABLE_OPENGLES */
151
152 void glClipPlane4f_(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
153
154 /*---------------------------------------------------------------------------*/
155
156 struct gl_info
157 {
158     GLint max_texture_units;
159     GLint max_texture_size;
160
161     unsigned int multitexture:1;
162     unsigned int vertex_buffer_object:1;
163     unsigned int point_parameters:1;
164 };
165
166 extern struct gl_info gli;
167
168 /*---------------------------------------------------------------------------*/
169 #endif