| 1 | // SuperTux |
| 2 | // Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com> |
| 3 | // |
| 4 | // This program is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (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, see <http://www.gnu.org/licenses/>. |
| 16 | |
| 17 | #ifndef HEADER_SUPERTUX_VIDEO_GL_HPP |
| 18 | #define |
| 19 | |
| 20 | #include <config.h> |
| 21 | |
| 22 | #ifdef HAVE_OPENGL |
| 23 | |
| 24 | #if defined(USE_OPENGLES2) |
| 25 | # include <SDL_opengles2.h> |
| 26 | #elif defined(USE_OPENGLES1) |
| 27 | # include <SDL_opengles.h> |
| 28 | #else |
| 29 | # ifdef USE_GLBINDING |
| 30 | # include <glbinding/gl/gl.h> |
| 31 | # include <glbinding/gl/bitfield.h> |
| 32 | # else |
| 33 | # include <GL/glew.h> |
| 34 | # define GL_NONE_BIT 0 |
| 35 | # endif |
| 36 | #endif |
| 37 | |
| 38 | #ifdef USE_OPENGLES1 |
| 39 | # define glOrtho glOrthof |
| 40 | #endif |
| 41 | |
| 42 | #ifdef USE_OPENGLES2 |
| 43 | // These are required for OpenGL3.3Core, but not availabel en GLES2, |
| 44 | // simple no-op replacement looks prettier than #ifdef |
| 45 | inline void glGenVertexArrays(GLsizei n, GLuint *arrays) {} |
| 46 | inline void glDeleteVertexArrays(GLsizei n, GLuint *arrays) {} |
| 47 | inline void glBindVertexArray(GLuint vao) {} |
| 48 | #endif |
| 49 | |
| 50 | #ifdef USE_GLBINDING |
| 51 | #ifdef __clang__ |
| 52 | #pragma clang diagnostic push |
| 53 | #pragma clang diagnostic ignored "-Wheader-hygiene" |
| 54 | #endif |
| 55 | using namespace gl; |
| 56 | #ifdef __clang__ |
| 57 | #pragma clang diagnostic pop |
| 58 | #endif |
| 59 | #endif |
| 60 | |
| 61 | #else |
| 62 | |
| 63 | // These are used by SDL code when OpenGL is completely disabled |
| 64 | #define GLint int |
| 65 | |
| 66 | enum GLenum { |
| 67 | GL_SRC_ALPHA, |
| 68 | GL_ONE_MINUS_SRC_ALPHA, |
| 69 | GL_RGBA, |
| 70 | GL_ONE, |
| 71 | GL_ZERO, |
| 72 | GL_DST_COLOR, |
| 73 | GL_LINEAR, |
| 74 | GL_NEAREST, |
| 75 | GL_CLAMP_TO_EDGE, |
| 76 | GL_MIRRORED_REPEAT, |
| 77 | GL_REPEAT |
| 78 | }; |
| 79 | |
| 80 | #endif |
| 81 | |
| 82 | #endif |
| 83 | |
| 84 | /* EOF */ |
| 85 | |