1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus - osal_opengl.h *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2013 Richard Goedeken *
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. *
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. *
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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22 #if !defined(OSAL_OPENGL_H)
25 #include <SDL_config.h>
27 #undef SDL_VIDEO_OPENGL
28 #define SDL_VIDEO_OPENGL_ES2 1
32 #include <SDL_opengl.h>
33 #define GLSL_VERSION "120"
36 #define OSAL_GL_ARB_MULTITEXTURE "GL_ARB_multitexture"
37 #define OSAL_GL_ARB_TEXTURE_ENV_ADD "GL_ARB_texture_env_add"
41 #elif SDL_VIDEO_OPENGL_ES2
42 #include <SDL_opengles2.h>
43 #define GLSL_VERSION "100"
46 #define OSAL_GL_ARB_MULTITEXTURE "GL_multitexture"
47 #define OSAL_GL_ARB_TEXTURE_ENV_ADD "GL_texture_env_add"
49 // Vertex shader params
52 #define VS_TEXCOORD0 2
53 #define VS_TEXCOORD1 3
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
70 #define GL_MODULATE 0x2100
71 #define GL_INTERPOLATE_ARB 0x8575
72 #define GL_CONSTANT_ARB 0x8576
73 #define GL_PREVIOUS_ARB 0x8578
75 // Function substitutions
76 #define glClearDepth glClearDepthf
77 #define pglActiveTexture glActiveTexture
78 #define pglActiveTextureARB glActiveTexture
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)
89 #endif // SDL_VIDEO_OPENGL*
91 #endif // OSAL_OPENGL_H