diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-07-17 18:16:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-07-17 20:08:12 +0300 |
commit | 6afba95ef62b22c303336adba6d891eeffe66c49 (patch) | |
tree | 2e395c216f22479064ad5cf2bda612d8ecb9f201 /src/graphicsvertexes.cpp | |
parent | b83bca17d42761c41f097ea315d01bb89105f618 (diff) | |
download | plus-6afba95ef62b22c303336adba6d891eeffe66c49.tar.gz plus-6afba95ef62b22c303336adba6d891eeffe66c49.tar.bz2 plus-6afba95ef62b22c303336adba6d891eeffe66c49.tar.xz plus-6afba95ef62b22c303336adba6d891eeffe66c49.zip |
Add basic tiles caching for opengl.
Diffstat (limited to 'src/graphicsvertexes.cpp')
-rw-r--r-- | src/graphicsvertexes.cpp | 60 |
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 } |