2 * Copyright (C) 2003-2011 Neverball authors
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.
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.
18 /*---------------------------------------------------------------------------*/
19 /* Include the system OpenGL headers. */
22 #define WIN32_LEAN_AND_MEAN
27 #include <OpenGL/gl.h>
36 /*---------------------------------------------------------------------------*/
38 #ifndef GL_MULTISAMPLE
39 #define GL_MULTISAMPLE 0x809D
43 #define GL_TEXTURE0 0x84C0
47 #define GL_TEXTURE1 0x84C1
51 #define GL_TEXTURE2 0x84C2
54 #ifndef GL_ARRAY_BUFFER
55 #define GL_ARRAY_BUFFER 0x8892
58 #ifndef GL_ELEMENT_ARRAY_BUFFER
59 #define GL_ELEMENT_ARRAY_BUFFER 0x8893
63 #define GL_STATIC_DRAW 0x88E4
66 #ifndef GL_DYNAMIC_DRAW
67 #define GL_DYNAMIC_DRAW 0x88E8
70 #ifndef GL_POINT_SPRITE
71 #define GL_POINT_SPRITE 0x8861
74 #ifndef GL_COORD_REPLACE
75 #define GL_COORD_REPLACE 0x8862
78 #ifndef GL_POINT_DISTANCE_ATTENUATIAN
79 #define GL_POINT_DISTANCE_ATTENUATION 0x8129
82 /*---------------------------------------------------------------------------*/
84 int glext_check(const char *);
87 /*---------------------------------------------------------------------------*/
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. */
94 #if defined(GL_VERSION_ES_CM_1_0) || \
95 defined(GL_VERSION_ES_CM_1_1) || \
96 defined(GL_OES_VERSION_1_0)
98 #define ENABLE_OPENGLES 1
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
110 #define glOrtho_ glOrthof
112 #else /* No native linkage? Define the extension API. */
114 #define glOrtho_ glOrtho
116 /*---------------------------------------------------------------------------*/
117 /* ARB_multitexture */
119 typedef void (*PFNGLACTIVETEXTURE_PROC)(GLenum);
120 typedef void (*PFNGLCLIENTACTIVETEXTURE_PROC)(GLenum);
122 extern PFNGLCLIENTACTIVETEXTURE_PROC glClientActiveTexture_;
123 extern PFNGLACTIVETEXTURE_PROC glActiveTexture_;
125 /*---------------------------------------------------------------------------*/
126 /* ARB_vertex_buffer_object */
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);
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_;
142 /*---------------------------------------------------------------------------*/
143 /* ARB_point_parameters */
145 typedef void (*PFNGLPOINTPARAMETERFV_PROC)(GLenum, const GLfloat *);
147 extern PFNGLPOINTPARAMETERFV_PROC glPointParameterfv_;
149 /*---------------------------------------------------------------------------*/
150 #endif /* !ENABLE_OPENGLES */
152 void glClipPlane4f_(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
154 /*---------------------------------------------------------------------------*/
158 GLint max_texture_units;
159 GLint max_texture_size;
161 unsigned int multitexture:1;
162 unsigned int vertex_buffer_object:1;
163 unsigned int point_parameters:1;
166 extern struct gl_info gli;
168 /*---------------------------------------------------------------------------*/