GLES2RICE: Update from upstream
[mupen64plus-pandora.git] / source / gles2rice / 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 #undef SDL_VIDEO_OPENGL
28 #define SDL_VIDEO_OPENGL_ES2 1
29
30
31 #if SDL_VIDEO_OPENGL
32 #include <SDL_opengl.h>
33 #define GLSL_VERSION "120"
34
35 // Extension names
36 #define OSAL_GL_ARB_MULTITEXTURE            "GL_ARB_multitexture"
37 #define OSAL_GL_ARB_TEXTURE_ENV_ADD         "GL_ARB_texture_env_add"
38
39
40
41 #elif SDL_VIDEO_OPENGL_ES2
42 #include <SDL_opengles2.h>
43 #define GLSL_VERSION "100"
44
45 // Extension names
46 #define OSAL_GL_ARB_MULTITEXTURE            "GL_multitexture"
47 #define OSAL_GL_ARB_TEXTURE_ENV_ADD         "GL_texture_env_add"
48
49 // Vertex shader params
50 #define VS_POSITION                         0
51 #define VS_COLOR                            1
52 #define VS_TEXCOORD0                        2
53 #define VS_TEXCOORD1                        3
54 #define VS_FOG                              4
55
56 // Constant substitutions
57 #define GL_CLAMP                            GL_CLAMP_TO_EDGE
58 #define GL_MAX_TEXTURE_UNITS_ARB            GL_MAX_TEXTURE_IMAGE_UNITS
59 #define GL_MIRRORED_REPEAT_ARB              GL_MIRRORED_REPEAT
60 #define GL_TEXTURE0_ARB                     GL_TEXTURE0
61 #define GL_TEXTURE1_ARB                     GL_TEXTURE1
62 #define GL_TEXTURE2_ARB                     GL_TEXTURE2
63 #define GL_TEXTURE3_ARB                     GL_TEXTURE3
64 #define GL_TEXTURE4_ARB                     GL_TEXTURE4
65 #define GL_TEXTURE5_ARB                     GL_TEXTURE5
66 #define GL_TEXTURE6_ARB                     GL_TEXTURE6
67 #define GL_TEXTURE7_ARB                     GL_TEXTURE7
68
69 #define GL_ADD                              0x0104
70 #define GL_MODULATE                         0x2100
71 #define GL_INTERPOLATE_ARB                  0x8575
72 #define GL_CONSTANT_ARB                     0x8576
73 #define GL_PREVIOUS_ARB                     0x8578
74
75 // Function substitutions
76 #define glClearDepth                        glClearDepthf
77 #define pglActiveTexture                    glActiveTexture
78 #define pglActiveTextureARB                 glActiveTexture
79
80 // No-op substitutions (unavailable in GLES2)
81 #define glLoadIdentity()
82 #define glMatrixMode(x)
83 #define glOrtho(a,b,c,d,e,f)
84 #define glReadBuffer(x)
85 #define glTexEnvi(x,y,z)
86 #define glTexEnvfv(x,y,z)
87 #define glTexCoord2f(u,v)
88
89 #endif // SDL_VIDEO_OPENGL*
90
91 #endif // OSAL_OPENGL_H