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>
28 #elif defined(__MAEMO__)
38 /*---------------------------------------------------------------------------*/
40 #ifndef GL_MULTISAMPLE
41 #define GL_MULTISAMPLE 0x809D
45 #define GL_TEXTURE0 0x84C0
49 #define GL_TEXTURE1 0x84C1
53 #define GL_TEXTURE2 0x84C2
56 #ifndef GL_ARRAY_BUFFER
57 #define GL_ARRAY_BUFFER 0x8892
60 #ifndef GL_ELEMENT_ARRAY_BUFFER
61 #define GL_ELEMENT_ARRAY_BUFFER 0x8893
65 #define GL_STATIC_DRAW 0x88E4
68 #ifndef GL_DYNAMIC_DRAW
69 #define GL_DYNAMIC_DRAW 0x88E8
72 #ifndef GL_POINT_SPRITE
73 #define GL_POINT_SPRITE 0x8861
76 #ifndef GL_COORD_REPLACE
77 #define GL_COORD_REPLACE 0x8862
80 #ifndef GL_POINT_DISTANCE_ATTENUATIAN
81 #define GL_POINT_DISTANCE_ATTENUATION 0x8129
84 /*---------------------------------------------------------------------------*/
86 int glext_check(const char *);
89 /*---------------------------------------------------------------------------*/
91 /* Exercise extreme paranoia in defining a cross-platform OpenGL interface. */
92 /* If we're compiling against OpenGL ES then we must assume native linkage */
93 /* of the extensions we use. Otherwise, GetProc them regardless of whether */
94 /* they need it or not. */
96 #if defined(GL_VERSION_ES_CM_1_0) || \
97 defined(GL_VERSION_ES_CM_1_1) || \
98 defined(GL_OES_VERSION_1_0)
100 #define ENABLE_OPENGLES 1
102 #define glClientActiveTexture_ glClientActiveTexture
103 #define glActiveTexture_ glActiveTexture
104 #define glGenBuffers_ glGenBuffers
105 #define glBindBuffer_ glBindBuffer
106 #define glBufferData_ glBufferData
107 #define glBufferSubData_ glBufferSubData
108 #define glDeleteBuffers_ glDeleteBuffers
109 #define glIsBuffer_ glIsBuffer
110 #define glPointParameterfv_ glPointParameterfv
112 #define glOrtho_ glOrthof
114 #else /* No native linkage? Define the extension API. */
116 #define glOrtho_ glOrtho
118 /*---------------------------------------------------------------------------*/
119 /* ARB_multitexture */
121 typedef void (*PFNGLACTIVETEXTURE_PROC)(GLenum);
122 typedef void (*PFNGLCLIENTACTIVETEXTURE_PROC)(GLenum);
124 extern PFNGLCLIENTACTIVETEXTURE_PROC glClientActiveTexture_;
125 extern PFNGLACTIVETEXTURE_PROC glActiveTexture_;
127 /*---------------------------------------------------------------------------*/
128 /* ARB_vertex_buffer_object */
130 typedef void (*PFNGLGENBUFFERS_PROC)(GLsizei, GLuint *);
131 typedef void (*PFNGLBINDBUFFER_PROC)(GLenum, GLuint);
132 typedef void (*PFNGLBUFFERDATA_PROC)(GLenum, GLsizeiptr, const GLvoid *, GLenum);
133 typedef void (*PFNGLBUFFERSUBDATA_PROC)(GLenum, GLintptr, GLsizeiptr, const GLvoid *);
134 typedef void (*PFNGLDELETEBUFFERS_PROC)(GLsizei, const GLuint *);
135 typedef GLboolean (*PFNGLISBUFFER_PROC)(GLuint);
137 extern PFNGLGENBUFFERS_PROC glGenBuffers_;
138 extern PFNGLBINDBUFFER_PROC glBindBuffer_;
139 extern PFNGLBUFFERDATA_PROC glBufferData_;
140 extern PFNGLBUFFERSUBDATA_PROC glBufferSubData_;
141 extern PFNGLDELETEBUFFERS_PROC glDeleteBuffers_;
142 extern PFNGLISBUFFER_PROC glIsBuffer_;
144 /*---------------------------------------------------------------------------*/
145 /* ARB_point_parameters */
147 typedef void (*PFNGLPOINTPARAMETERFV_PROC)(GLenum, const GLfloat *);
149 extern PFNGLPOINTPARAMETERFV_PROC glPointParameterfv_;
151 /*---------------------------------------------------------------------------*/
152 #endif /* !ENABLE_OPENGLES */
154 void glClipPlane4f_(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
156 /*---------------------------------------------------------------------------*/
160 GLint max_texture_units;
161 GLint max_texture_size;
163 unsigned int multitexture:1;
164 unsigned int vertex_buffer_object:1;
165 unsigned int point_parameters:1;
168 extern struct gl_info gli;
170 /*---------------------------------------------------------------------------*/