summaryrefslogtreecommitdiff
path: root/src/graphicsvertexes.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-17 18:16:49 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-17 20:08:12 +0300
commit6afba95ef62b22c303336adba6d891eeffe66c49 (patch)
tree2e395c216f22479064ad5cf2bda612d8ecb9f201 /src/graphicsvertexes.cpp
parentb83bca17d42761c41f097ea315d01bb89105f618 (diff)
downloadmanaverse-6afba95ef62b22c303336adba6d891eeffe66c49.tar.gz
manaverse-6afba95ef62b22c303336adba6d891eeffe66c49.tar.bz2
manaverse-6afba95ef62b22c303336adba6d891eeffe66c49.tar.xz
manaverse-6afba95ef62b22c303336adba6d891eeffe66c49.zip
Add basic tiles caching for opengl.
Diffstat (limited to 'src/graphicsvertexes.cpp')
-rw-r--r--src/graphicsvertexes.cpp60
1 files changed, 58 insertions, 2 deletions
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index d905b8b64..b8e236310 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -110,6 +110,62 @@ void OpenGLGraphicsVertexes::switchVp(int n)
{
mVp.push_back(n);
}
+
+int OpenGLGraphicsVertexes::continueVp()
+{
+ if (mVp.empty())
+ {
+ return 0;
+ }
+ else
+ {
+ const int val = mVp.back();
+ mVp.pop_back();
+ return val;
+ }
+}
+
+GLfloat *OpenGLGraphicsVertexes::continueFloatTexArray()
+{
+ if (mFloatTexPool.empty())
+ {
+ mFloatTexArray = new GLfloat[vertexBufSize * 4 + 30];
+ mFloatTexPool.push_back(mFloatTexArray);
+ }
+ else
+ {
+ mFloatTexArray = mFloatTexPool.back();
+ }
+ return mFloatTexArray;
+}
+
+GLint *OpenGLGraphicsVertexes::continueIntVertArray()
+{
+ if (mIntVertPool.empty())
+ {
+ mIntVertArray = new GLint[vertexBufSize * 4 + 30];
+ mIntVertPool.push_back(mIntVertArray);
+ }
+ else
+ {
+ mIntVertArray = mIntVertPool.back();
+ }
+ return mIntVertArray;
+}
+
+GLint *OpenGLGraphicsVertexes::continueIntTexArray()
+{
+ if (mIntTexPool.empty())
+ {
+ mIntTexArray = new GLint[vertexBufSize * 4 + 30];
+ mIntTexPool.push_back(mIntTexArray);
+ }
+ else
+ {
+ mIntTexArray = mIntTexPool.back();
+ }
+ return mIntTexArray;
+}
#endif
GraphicsVertexes::GraphicsVertexes() :
@@ -171,7 +227,7 @@ ImageVertexes::~ImageVertexes()
delete_all(sdl);
sdl.clear();
#ifdef USE_OPENGL
- delete_all(ogl);
- ogl.clear();
+ delete ogl;
+ ogl = 0;
#endif
}