ManaPlus
normalopenglgraphics.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_NORMALOPENGLGRAPHICS_H
25 #define RENDER_NORMALOPENGLGRAPHICS_H
26 
27 #ifdef USE_OPENGL
28 #if !defined(ANDROID) && !defined(__native_client__) && !defined(__SWITCH__)
29 
30 #include "localconsts.h"
31 
32 #include "render/graphics.h"
33 
34 #include "resources/fboinfo.h"
35 
36 #ifdef ANDROID
37 #include <GLES/gl.h>
38 #include <GLES/glext.h>
39 #include <GLES2/gl2.h>
40 #else // ANDROID
41 #ifndef USE_SDL2
42 #define GL_GLEXT_PROTOTYPES 1
43 #endif // USE_SDL2
44 PRAGMA48(GCC diagnostic push)
45 PRAGMA48(GCC diagnostic ignored "-Wshadow")
46 // ignore -Wredundant-decls for SDL 1.2
47 PRAGMA45(GCC diagnostic push)
48 PRAGMA45(GCC diagnostic ignored "-Wredundant-decls")
49 #include <SDL_opengl.h>
50 PRAGMA45(GCC diagnostic pop)
51 PRAGMA48(GCC diagnostic pop)
52 #if defined(__APPLE__)
53 #include <OpenGL/glext.h>
54 #elif !defined(__native_client__)
55 PRAGMA45(GCC diagnostic push)
56 PRAGMA45(GCC diagnostic ignored "-Wredundant-decls")
57 #include <GL/glext.h>
58 PRAGMA45(GCC diagnostic pop)
59 #endif // defined(__APPLE__)
60 #endif // ANDROID
61 
62 class OpenGLGraphicsVertexes;
63 
65 {
66  public:
68 
70 
71  ~NormalOpenGLGraphics() override final;
72 
73  inline void drawQuadArrayfi(const int size) restrict2 A_INLINE;
74 
75  inline void drawQuadArrayfiCached(const int size) restrict2 A_INLINE;
76 
77  inline void drawQuadArrayfi(const GLint *restrict const intVertArray,
78  const GLfloat *restrict const
79  floatTexArray,
80  const int size) restrict2 A_INLINE;
81 
82  inline void drawQuadArrayii(const int size) restrict2 A_INLINE;
83 
84  inline void drawQuadArrayiiCached(const int size) restrict2 A_INLINE;
85 
86  inline void drawQuadArrayii(const GLint *restrict const intVertArray,
87  const GLint *restrict const intTexArray,
88  const int size) restrict2 A_INLINE;
89 
90  inline void drawLineArrayi(const int size) restrict2 A_INLINE;
91 
92  inline void drawLineArrayf(const int size) restrict2 A_INLINE;
93 
94  void testDraw() restrict2 override final;
95 
96  #include "render/graphicsdef.hpp"
98 
101 
104 
107 
108 #ifdef DEBUG_BIND_TEXTURE
109  unsigned int getBinds() const restrict2 noexcept2
110  { return mLastBinds; }
111 #endif // DEBUG_BIND_TEXTURE
112 
113  private:
122  bool mTexture;
123 
126  GLuint mImageCached;
127  float mFloatColor;
130 #ifdef DEBUG_BIND_TEXTURE
131  std::string mOldTexture;
132  unsigned int mOldTextureId;
133  static unsigned int mBinds;
134  static unsigned int mLastBinds;
135 #endif // DEBUG_BIND_TEXTURE
136 
137  FBOInfo mFbo;
138 };
139 #endif // !defined ANDROID && !defined(__native_client__) &&
140  // !defined(__SWITCH__)
141 #endif // USE_OPENGL
142 
143 #endif // RENDER_NORMALOPENGLGRAPHICS_H
Definition: color.h:76
void drawLineArrayi(const int size) A_INLINE
void drawQuadArrayfi(const int size) A_INLINE
void drawLineArrayf(const int size) A_INLINE
void drawQuadArrayfiCached(const int size) A_INLINE
void drawQuadArrayii(const int size) A_INLINE
void drawQuadArrayiiCached(const int size) A_INLINE
#define RENDER_GRAPHICSDEF_HPP
Definition: graphicsdef.hpp:24
#define restrict
Definition: localconsts.h:165
#define restrict2
Definition: localconsts.h:166
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define PRAGMA48(str)
Definition: localconsts.h:199
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
int size()
Definition: emotedb.cpp:306
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wredundant-decls") PRAGMA45(GCC diagnostic pop) PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wredundant-decls") PRAGMA45(GCC diagnostic pop) class OpenGLGraphicsVertexes
#define RENDER_OPENGLGRAPHICSDEF1_HPP
#define RENDER_OPENGLGRAPHICSDEF_HPP
#define RENDER_OPENGLGRAPHICSDEFADVANCED_HPP