d07c171f |
1 | /* OGLExtensions.h |
2 | Copyright (C) 2009 Richard Goedeken |
3 | |
4 | This program is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU General Public License |
6 | as published by the Free Software Foundation; either version 2 |
7 | of the License, or (at your option) any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software |
16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ |
18 | |
19 | /* This header file contains function pointers to some OpenGL functions */ |
20 | /* This is only necessary because Windows does not contain development support for OpenGL versions beyond 1.1 */ |
21 | |
22 | #if !defined(OGL_EXTENSIONS_H) |
23 | #define OGL_EXTENSIONS_H |
24 | |
25 | #ifdef HAVE_GLES |
26 | #include <SDL_opengles.h> |
27 | #define APIENTRYP GL_API |
28 | #else |
29 | #include <SDL_opengl.h> |
30 | #endif |
31 | |
32 | /* Just call this one function to load up the function pointers. */ |
33 | void OGLExtensions_Init(void); |
34 | |
35 | /* The function pointer types are defined here because as of 2009 some OpenGL drivers under Linux do 'incorrect' things which |
36 | mess up the SDL_opengl.h header, resulting in no function pointer typedefs at all, and thus compilation errors. |
37 | */ |
38 | #ifdef HAVE_GLES |
39 | static void myglMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t) |
40 | { |
41 | glMultiTexCoord4f(target, s, t, 0.0f, 1.0f); |
42 | } |
43 | static void myglMultiTexCoord2fv(GLenum target, const GLfloat *v) |
44 | { |
45 | glMultiTexCoord4f(target, v[0], v[1], 0.0f, 1.0f); |
46 | } |
47 | |
48 | #define pglActiveTexture glActiveTexture |
49 | #define pglActiveTextureARB glActiveTexture |
50 | #define pglMultiTexCoord2f myglMultiTexCoord2f |
51 | #define pglMultiTexCoord2fv myglMultiTexCoord2fv |
52 | #define pglDeleteProgramsARB(a,b) {} |
53 | #define pglProgramStringARB(a,b,c,d) {} |
54 | #define pglBindProgramARB(a,b) {} |
55 | #define pglGenProgramsARB(a,b) {} |
56 | #define pglProgramEnvParameter4fvARB(a,b,c) {} |
57 | #define pglFogCoordPointerEXT(a,b,c) {} |
58 | #define pglClientActiveTextureARB glClientActiveTexture |
59 | |
60 | #else |
61 | typedef void (APIENTRYP PFUNCGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); |
62 | typedef void (APIENTRYP PFUNCGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); |
63 | typedef void (APIENTRYP PFUNCGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); |
64 | typedef void (APIENTRYP PFUNCGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); |
65 | typedef void (APIENTRYP PFUNCGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); |
66 | |
67 | typedef void (APIENTRYP PFUNCGLACTIVETEXTUREPROC) (GLenum texture); |
68 | typedef void (APIENTRYP PFUNCGLACTIVETEXTUREARBPROC) (GLenum texture); |
69 | typedef void (APIENTRYP PFUNCGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); |
70 | typedef void (APIENTRYP PFUNCGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); |
71 | typedef void (APIENTRYP PFUNCGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); |
72 | typedef void (APIENTRYP PFUNCGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); |
73 | typedef void (APIENTRYP PFUNCGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); |
74 | typedef void (APIENTRYP PFUNCGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); |
75 | typedef void (APIENTRYP PFUNCGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); |
76 | typedef void (APIENTRYP PFUNCGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); |
77 | typedef void (APIENTRYP PFUNCGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); |
78 | #endif |
79 | extern bool bNvidiaExtensionsSupported; |
80 | #ifndef HAVE_GLES |
81 | extern PFUNCGLCOMBINERPARAMETERFVNVPROC pglCombinerParameterfvNV; |
82 | extern PFUNCGLFINALCOMBINERINPUTNVPROC pglFinalCombinerInputNV; |
83 | extern PFUNCGLCOMBINEROUTPUTNVPROC pglCombinerOutputNV; |
84 | extern PFUNCGLCOMBINERINPUTNVPROC pglCombinerInputNV; |
85 | extern PFUNCGLCOMBINERPARAMETERINVPROC pglCombinerParameteriNV; |
86 | |
87 | extern PFUNCGLACTIVETEXTUREPROC pglActiveTexture; |
88 | extern PFUNCGLACTIVETEXTUREARBPROC pglActiveTextureARB; |
89 | extern PFUNCGLMULTITEXCOORD2FPROC pglMultiTexCoord2f; |
90 | extern PFUNCGLMULTITEXCOORD2FVPROC pglMultiTexCoord2fv; |
91 | extern PFUNCGLDELETEPROGRAMSARBPROC pglDeleteProgramsARB; |
92 | extern PFUNCGLPROGRAMSTRINGARBPROC pglProgramStringARB; |
93 | extern PFUNCGLBINDPROGRAMARBPROC pglBindProgramARB; |
94 | extern PFUNCGLGENPROGRAMSARBPROC pglGenProgramsARB; |
95 | extern PFUNCGLPROGRAMENVPARAMETER4FVARBPROC pglProgramEnvParameter4fvARB; |
96 | extern PFUNCGLFOGCOORDPOINTEREXTPROC pglFogCoordPointerEXT; |
97 | extern PFUNCGLCLIENTACTIVETEXTUREARBPROC pglClientActiveTextureARB; |
98 | #endif |
99 | #endif // OGL_EXTENSIONS_H |
100 | |