summaryrefslogtreecommitdiff
path: root/src/graphicsvertexes.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-25 21:43:32 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-26 13:48:26 +0300
commit9abb51fce0cca32ebe267c4797363d99520c2a0a (patch)
treee0a22c5dc699fdd0f85d04ff1aa96196cc8d43ac /src/graphicsvertexes.cpp
parent5ff486002243e1481e6686494a85480a85220451 (diff)
downloadmanaverse-9abb51fce0cca32ebe267c4797363d99520c2a0a.tar.gz
manaverse-9abb51fce0cca32ebe267c4797363d99520c2a0a.tar.bz2
manaverse-9abb51fce0cca32ebe267c4797363d99520c2a0a.tar.xz
manaverse-9abb51fce0cca32ebe267c4797363d99520c2a0a.zip
Add initial version of mobile OpenGL backend.
Diffstat (limited to 'src/graphicsvertexes.cpp')
-rw-r--r--src/graphicsvertexes.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index 407d5ef0c..aefe594fd 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -25,6 +25,7 @@
#include "debug.h"
#ifdef USE_OPENGL
+unsigned int vertexBufSize = 500;
int GraphicsVertexes::mUseOpenGL = 0;
#endif
@@ -43,10 +44,12 @@ NormalOpenGLGraphicsVertexes::NormalOpenGLGraphicsVertexes() :
ptr(0),
mFloatTexArray(nullptr),
mIntTexArray(nullptr),
- mIntVertArray(nullptr)
+ mIntVertArray(nullptr),
+ mShortVertArray(nullptr)
{
mFloatTexPool.reserve(30);
mIntVertPool.reserve(30);
+ mShortVertPool.reserve(30);
mIntTexPool.reserve(30);
mVp.reserve(30);
}
@@ -72,6 +75,13 @@ void NormalOpenGLGraphicsVertexes::clear()
}
mIntVertPool.clear();
+ for (std::vector<GLshort*>::iterator it = mShortVertPool.begin();
+ it != mShortVertPool.end(); ++ it)
+ {
+ delete [] (*it);
+ }
+ mShortVertPool.clear();
+
for (std::vector<GLint*>::iterator it = mIntTexPool.begin();
it != mIntTexPool.end(); ++ it)
{
@@ -86,6 +96,7 @@ void NormalOpenGLGraphicsVertexes::clear()
delete []mFloatTexArray;
delete []mIntTexArray;
delete []mIntVertArray;
+ delete []mShortVertArray;
}
}
@@ -108,6 +119,13 @@ GLint *NormalOpenGLGraphicsVertexes::switchIntVertArray()
return mIntVertArray;
}
+GLshort *NormalOpenGLGraphicsVertexes::switchShortVertArray()
+{
+ mShortVertArray = new GLshort[vertexBufSize * 4 + 30];
+ mShortVertPool.push_back(mShortVertArray);
+ return mShortVertArray;
+}
+
GLint *NormalOpenGLGraphicsVertexes::switchIntTexArray()
{
mIntTexArray = new GLint[vertexBufSize * 4 + 30];
@@ -169,6 +187,20 @@ GLint *NormalOpenGLGraphicsVertexes::continueIntVertArray()
return mIntVertArray;
}
+GLshort *NormalOpenGLGraphicsVertexes::continueShortVertArray()
+{
+ if (mShortVertPool.empty())
+ {
+ mShortVertArray = new GLshort[vertexBufSize * 4 + 30];
+ mShortVertPool.push_back(mShortVertArray);
+ }
+ else
+ {
+ mShortVertArray = mShortVertPool.back();
+ }
+ return mShortVertArray;
+}
+
GLint *NormalOpenGLGraphicsVertexes::continueIntTexArray()
{
if (mIntTexPool.empty())