PANDORA: Make GLES context compatible with latest driver (FB only, no X11)
[mupen64plus-pandora.git] / source / rice_gles / src / OGLExtensions.h
CommitLineData
d07c171f 1/* OGLExtensions.h
2Copyright (C) 2009 Richard Goedeken
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, 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. */
33void 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
39static void myglMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
40{
41 glMultiTexCoord4f(target, s, t, 0.0f, 1.0f);
42}
43static 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
61typedef void (APIENTRYP PFUNCGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
62typedef void (APIENTRYP PFUNCGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
63typedef void (APIENTRYP PFUNCGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
64typedef void (APIENTRYP PFUNCGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
65typedef void (APIENTRYP PFUNCGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
66
67typedef void (APIENTRYP PFUNCGLACTIVETEXTUREPROC) (GLenum texture);
68typedef void (APIENTRYP PFUNCGLACTIVETEXTUREARBPROC) (GLenum texture);
69typedef void (APIENTRYP PFUNCGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
70typedef void (APIENTRYP PFUNCGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
71typedef void (APIENTRYP PFUNCGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
72typedef void (APIENTRYP PFUNCGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
73typedef void (APIENTRYP PFUNCGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
74typedef void (APIENTRYP PFUNCGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
75typedef void (APIENTRYP PFUNCGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
76typedef void (APIENTRYP PFUNCGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
77typedef void (APIENTRYP PFUNCGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
78#endif
79extern bool bNvidiaExtensionsSupported;
80#ifndef HAVE_GLES
81extern PFUNCGLCOMBINERPARAMETERFVNVPROC pglCombinerParameterfvNV;
82extern PFUNCGLFINALCOMBINERINPUTNVPROC pglFinalCombinerInputNV;
83extern PFUNCGLCOMBINEROUTPUTNVPROC pglCombinerOutputNV;
84extern PFUNCGLCOMBINERINPUTNVPROC pglCombinerInputNV;
85extern PFUNCGLCOMBINERPARAMETERINVPROC pglCombinerParameteriNV;
86
87extern PFUNCGLACTIVETEXTUREPROC pglActiveTexture;
88extern PFUNCGLACTIVETEXTUREARBPROC pglActiveTextureARB;
89extern PFUNCGLMULTITEXCOORD2FPROC pglMultiTexCoord2f;
90extern PFUNCGLMULTITEXCOORD2FVPROC pglMultiTexCoord2fv;
91extern PFUNCGLDELETEPROGRAMSARBPROC pglDeleteProgramsARB;
92extern PFUNCGLPROGRAMSTRINGARBPROC pglProgramStringARB;
93extern PFUNCGLBINDPROGRAMARBPROC pglBindProgramARB;
94extern PFUNCGLGENPROGRAMSARBPROC pglGenProgramsARB;
95extern PFUNCGLPROGRAMENVPARAMETER4FVARBPROC pglProgramEnvParameter4fvARB;
96extern PFUNCGLFOGCOORDPOINTEREXTPROC pglFogCoordPointerEXT;
97extern PFUNCGLCLIENTACTIVETEXTUREARBPROC pglClientActiveTextureARB;
98#endif
99#endif // OGL_EXTENSIONS_H
100