Rice Video Plugin for GLES1.1
[mupen64plus-pandora.git] / source / rice_gles / src / osal_opengl.h
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  *   Mupen64plus - osal_opengl.h                                           *
3  *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
4  *   Copyright (C) 2013 Richard Goedeken                                   *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  *   This program is distributed in the hope that it will be useful,       *
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14  *   GNU General Public License for more details.                          *
15  *                                                                         *
16  *   You should have received a copy of the GNU General Public License     *
17  *   along with this program; if not, write to the                         *
18  *   Free Software Foundation, Inc.,                                       *
19  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
20  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
22 #if !defined(OSAL_OPENGL_H)
23 #define OSAL_OPENGL_H
24
25 #include <SDL_config.h>
26
27 #if SDL_VIDEO_OPENGL
28 #ifdef HAVE_GLES
29 #include <SDL_opengles.h>
30 #define GL_CLAMP                        GL_CLAMP_TO_EDGE
31 #define GL_MAX_TEXTURE_UNITS_ARB        GL_MAX_TEXTURE_UNITS
32 #define GL_MIRRORED_REPEAT_ARB          GL_MIRRORED_REPEAT_OES
33 #define GL_MIRRORED_REPEAT_IBM          GL_MIRRORED_REPEAT_OES
34 #define GL_TEXTURE0_ARB                 GL_TEXTURE0
35 #define GL_TEXTURE1_ARB                 GL_TEXTURE1
36 #define GL_TEXTURE2_ARB                 GL_TEXTURE2
37 #define GL_TEXTURE3_ARB                 GL_TEXTURE3
38 #define GL_TEXTURE4_ARB                 GL_TEXTURE4
39 #define GL_TEXTURE5_ARB                 GL_TEXTURE5
40 #define GL_TEXTURE6_ARB                 GL_TEXTURE6
41 #define GL_TEXTURE7_ARB                 GL_TEXTURE7
42 #define GL_ADD_SIGNED_ARB               GL_ADD_SIGNED
43 #define GL_SUBTRACT_ARB                 GL_SUBTRACT
44 #define GL_INTERPOLATE_ARB              GL_INTERPOLATE
45 #define GL_CONSTANT_ARB                 GL_CONSTANT
46 #define GL_PREVIOUS_ARB                 GL_PREVIOUS
47 #define GL_COMBINE_ARB                  GL_COMBINE
48 #define GL_COMBINE_RGB_ARB              GL_COMBINE_RGB
49 #define GL_PRIMARY_COLOR_ARB            GL_PRIMARY_COLOR
50 #define GL_SOURCE0_RGB_ARB              GL_SRC0_RGB
51 #define GL_OPERAND0_RGB_ARB             GL_OPERAND0_RGB
52 #define GL_SOURCE1_RGB_ARB              GL_SRC1_RGB
53 #define GL_OPERAND1_RGB_ARB             GL_OPERAND1_RGB
54 #define GL_SOURCE2_RGB_ARB              GL_SRC2_RGB
55 #define GL_OPERAND2_RGB_ARB             GL_OPERAND2_RGB
56 #define GL_SOURCE3_RGB_ARB              GL_SRC3_RGB
57 #define GL_OPERAND3_RGB_ARB             GL_OPERAND3_RGB
58 #define GL_SOURCE0_ALPHA_ARB            GL_SRC0_ALPHA
59 #define GL_OPERAND0_ALPHA_ARB           GL_OPERAND0_ALPHA
60 #define GL_SOURCE1_ALPHA_ARB            GL_SRC1_ALPHA
61 #define GL_OPERAND1_ALPHA_ARB           GL_OPERAND1_ALPHA
62 #define GL_SOURCE2_ALPHA_ARB            GL_SRC2_ALPHA
63 #define GL_OPERAND2_ALPHA_ARB           GL_OPERAND2_ALPHA
64 #define GL_SOURCE3_ALPHA_ARB            GL_SRC3_ALPHA
65 #define GL_OPERAND3_ALPHA_ARB           GL_OPERAND3_ALPHA
66 #define GL_MAX_TEXTURE_IMAGE_UNITS      GL_MAX_TEXTURE_UNITS
67
68 #define glClearDepth                    glClearDepthf
69 #define glDepthRange                    glDepthRangef
70 #define glOrtho                         glOrthof
71
72 #define APIENTRYP               GL_API
73
74 #else
75 #include <SDL_opengl.h>
76 #define GLSL_VERSION "120"
77
78 // Extension names
79 #define OSAL_GL_ARB_MULTITEXTURE            "GL_ARB_multitexture"
80 #define OSAL_GL_ARB_TEXTURE_ENV_ADD         "GL_ARB_texture_env_add"
81 #endif
82
83
84 #elif SDL_VIDEO_OPENGL_ES2
85 #include <SDL_opengles2.h>
86 #define GLSL_VERSION "100"
87
88 // Extension names
89 #define OSAL_GL_ARB_MULTITEXTURE            "GL_multitexture"
90 #define OSAL_GL_ARB_TEXTURE_ENV_ADD         "GL_texture_env_add"
91
92 // Vertex shader params
93 #define VS_POSITION                         0
94 #define VS_COLOR                            1
95 #define VS_TEXCOORD0                        2
96 #define VS_TEXCOORD1                        3
97
98 // Constant substitutions
99 #define GL_CLAMP                            GL_CLAMP_TO_EDGE
100 #define GL_MAX_TEXTURE_UNITS_ARB            GL_MAX_TEXTURE_IMAGE_UNITS
101 #define GL_MIRRORED_REPEAT_ARB              GL_MIRRORED_REPEAT
102 #define GL_TEXTURE0_ARB                     GL_TEXTURE0
103 #define GL_TEXTURE1_ARB                     GL_TEXTURE1
104 #define GL_TEXTURE2_ARB                     GL_TEXTURE2
105 #define GL_TEXTURE3_ARB                     GL_TEXTURE3
106 #define GL_TEXTURE4_ARB                     GL_TEXTURE4
107 #define GL_TEXTURE5_ARB                     GL_TEXTURE5
108 #define GL_TEXTURE6_ARB                     GL_TEXTURE6
109 #define GL_TEXTURE7_ARB                     GL_TEXTURE7
110
111 #define GL_ADD                              0x0104
112 #define GL_MODULATE                         0x2100
113 #define GL_INTERPOLATE_ARB                  0x8575
114 #define GL_CONSTANT_ARB                     0x8576
115 #define GL_PREVIOUS_ARB                     0x8578
116
117 // Function substitutions
118 #define glClearDepth                        glClearDepthf
119 #define pglActiveTexture                    glActiveTexture
120 #define pglActiveTextureARB                 glActiveTexture
121
122 // No-op substitutions (unavailable in GLES2)
123 #define glLoadIdentity()
124 #define glMatrixMode(x)
125 #define glOrtho(a,b,c,d,e,f)
126 #define glReadBuffer(x)
127 #define glTexEnvi(x,y,z)
128 #define glTexEnvfv(x,y,z)
129 #define glTexCoord2f(u,v)
130
131 #endif // SDL_VIDEO_OPENGL*
132
133 #endif // OSAL_OPENGL_H