ManaPlus
safeopenglgraphics.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef RENDER_SAFEOPENGLGRAPHICS_H
25 #define RENDER_SAFEOPENGLGRAPHICS_H
26 
27 #if defined USE_OPENGL && !defined ANDROID && !defined(__SWITCH__)
28 
29 #include "render/graphics.h"
30 
31 #include "resources/fboinfo.h"
32 
33 #ifdef ANDROID
34 #include <GLES/gl.h>
35 #include <GLES/glext.h>
36 #else // ANDROID
37 #ifndef USE_SDL2
38 #define GL_GLEXT_PROTOTYPES 1
39 #endif // USE_SDL2
40 PRAGMA48(GCC diagnostic push)
41 PRAGMA48(GCC diagnostic ignored "-Wshadow")
42 // ignore -Wredundant-decls for SDL 1.2
43 PRAGMA45(GCC diagnostic push)
44 PRAGMA45(GCC diagnostic ignored "-Wredundant-decls")
45 #include <SDL_opengl.h>
46 PRAGMA45(GCC diagnostic pop)
47 PRAGMA48(GCC diagnostic pop)
48 #if defined(__APPLE__)
49 #include <OpenGL/glext.h>
50 #elif !defined(__native_client__)
51 PRAGMA45(GCC diagnostic push)
52 PRAGMA45(GCC diagnostic ignored "-Wredundant-decls")
53 #include <GL/glext.h>
54 PRAGMA45(GCC diagnostic pop)
55 #endif // defined(__APPLE__)
56 #endif // ANDROID
57 
58 class SafeOpenGLGraphics final : public Graphics
59 {
60  public:
61  SafeOpenGLGraphics();
62 
63  A_DELETE_COPY(SafeOpenGLGraphics)
64 
65  ~SafeOpenGLGraphics() override final;
66 
67  void testDraw() restrict2 override final;
68 
69  #include "render/graphicsdef.hpp"
71 
74 
77 
78  private:
79  bool mTexture;
80  bool mIsByteColor;
81  Color mByteColor;
82  float mFloatColor;
83  bool mColorAlpha;
84  FBOInfo mFbo;
85 };
86 
87 #endif // defined USE_OPENGL && !defined ANDROID
88 #endif // RENDER_SAFEOPENGLGRAPHICS_H
Definition: color.h:76
virtual void testDraw()
Definition: graphics.h:473
#define RENDER_GRAPHICSDEF_HPP
Definition: graphicsdef.hpp:24
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wredundant-decls") PRAGMA45(GCC diagnostic pop) class TestMain
#define restrict2
Definition: localconsts.h:166
#define final
Definition: localconsts.h:46
#define PRAGMA48(str)
Definition: localconsts.h:199
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
#define RENDER_OPENGLGRAPHICSDEF1_HPP
#define RENDER_OPENGLGRAPHICSDEF_HPP