ManaPlus
openglgraphicsvertexes.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef RENDER_VERTEXES_OPENGLGRAPHICSVERTEXES_H
23 #define RENDER_VERTEXES_OPENGLGRAPHICSVERTEXES_H
24 
25 #ifdef USE_OPENGL
26 
27 #include "localconsts.h"
28 
29 #ifdef ANDROID
30 #include <GLES/gl.h>
31 #else // ANDROID
32 #ifndef USE_SDL2
33 #define GL_GLEXT_PROTOTYPES 1
34 #endif // USE_SDL2
35 PRAGMA48(GCC diagnostic push)
36 PRAGMA48(GCC diagnostic ignored "-Wshadow")
37 // ignore -Wredundant-decls for SDL 1.2
38 PRAGMA45(GCC diagnostic push)
39 PRAGMA45(GCC diagnostic ignored "-Wredundant-decls")
40 #define GL_GLEXT_LEGACY
41 #include <SDL_opengl.h>
42 PRAGMA45(GCC diagnostic pop)
43 PRAGMA48(GCC diagnostic pop)
44 #endif // ANDROID
45 
46 #include "utils/vector.h"
47 
48 class OpenGLGraphicsVertexes final
49 {
50  public:
51  OpenGLGraphicsVertexes();
52 
53  A_DELETE_COPY(OpenGLGraphicsVertexes)
54 
55  ~OpenGLGraphicsVertexes();
56 
57  GLfloat *switchFloatTexArray() restrict2;
58 
59  GLint *switchIntVertArray() restrict2;
60 
61  GLint *switchIntTexArray() restrict2;
62 
63  GLshort *switchShortVertArray() restrict2;
64 
65  STD_VECTOR<GLfloat*> *getFloatTexPool() restrict2 A_WARN_UNUSED
66  { return &mFloatTexPool; }
67 
68  STD_VECTOR<GLint*> *getIntVertPool() restrict2 A_WARN_UNUSED
69  { return &mIntVertPool; }
70 
71  STD_VECTOR<GLshort*> *getShortVertPool() restrict2 A_WARN_UNUSED
72  { return &mShortVertPool; }
73 
74  STD_VECTOR<GLint*> *getIntTexPool() restrict2 A_WARN_UNUSED
75  { return &mIntTexPool; }
76 
77  void switchVp(const int n) restrict2;
78 
79  GLfloat *continueFloatTexArray() restrict2 RETURNS_NONNULL;
80 
81  GLint *continueIntVertArray() restrict2 RETURNS_NONNULL;
82 
83  GLshort *continueShortVertArray() restrict2 RETURNS_NONNULL;
84 
85  GLint *continueIntTexArray() restrict2 RETURNS_NONNULL;
86 
87  int continueVp() restrict2;
88 
89  void updateVp(const int n) restrict2;
90 
91  STD_VECTOR<int> *getVp() restrict2 A_WARN_UNUSED
92  { return &mVp; }
93 
94  void init() restrict2;
95 
96  void clear() restrict2;
97 
98  int ptr;
99 
100  GLfloat *mFloatTexArray;
101  GLint *mIntTexArray;
102  GLint *mIntVertArray;
103  GLshort *mShortVertArray;
104  STD_VECTOR<int> mVp;
105  STD_VECTOR<GLfloat*> mFloatTexPool;
106  STD_VECTOR<GLint*> mIntVertPool;
107  STD_VECTOR<GLshort*> mShortVertPool;
108  STD_VECTOR<GLint*> mIntTexPool;
109  STD_VECTOR<GLuint> mVbo;
110 };
111 
112 extern unsigned int vertexBufSize;
113 #endif // USE_OPENGL
114 
115 #endif // RENDER_VERTEXES_OPENGLGRAPHICSVERTEXES_H
#define restrict2
Definition: localconsts.h:166
#define RETURNS_NONNULL
Definition: localconsts.h:167
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define final
Definition: localconsts.h:46
#define PRAGMA48(str)
Definition: localconsts.h:199
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
void init()
Definition: playerinfo.cpp:434
void clear()
Definition: playerinfo.cpp:452
unsigned int vertexBufSize
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wredundant-decls") PRAGMA45(GCC diagnostic pop) class OpenGLGraphicsVertexes