diff options
-rw-r--r-- | src/localconsts.h | 2 | ||||
-rw-r--r-- | src/render/mobileopenglgraphics.cpp | 12 | ||||
-rw-r--r-- | src/render/normalopenglgraphics.cpp | 18 | ||||
-rw-r--r-- | src/render/nullopenglgraphics.cpp | 9 |
4 files changed, 27 insertions, 14 deletions
diff --git a/src/localconsts.h b/src/localconsts.h index 92c36d92a..f9f9f4ba0 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -95,7 +95,7 @@ // #define ANDROID_LOG 1 // profiler -// #define USE_PROFILER 1 +#define USE_PROFILER 1 // draw calls // #define DEBUG_DRAW_CALLS 1 diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 86707fac8..c815d096d 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -113,10 +113,14 @@ void MobileOpenGLGraphics::initArrays() // need alocate small size, after if limit reached reallocate to double size const int sz = mMaxVertices * 4 + 30; vertexBufSize = mMaxVertices; - mFloatTexArray = new GLfloat[sz]; - mShortVertArray = new GLshort[sz]; - mFloatTexArrayCached = new GLfloat[sz]; - mShortVertArrayCached = new GLshort[sz]; + if (!mFloatTexArray) + mFloatTexArray = new GLfloat[sz]; + if (!mShortVertArray) + mShortVertArray = new GLshort[sz]; + if (!mFloatTexArrayCached) + mFloatTexArrayCached = new GLfloat[sz]; + if (!mShortVertArrayCached) + mShortVertArrayCached = new GLshort[sz]; } bool MobileOpenGLGraphics::setVideoMode(const int w, const int h, diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 6bc25be32..ebac68e1b 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -131,12 +131,18 @@ void NormalOpenGLGraphics::initArrays() // need alocate small size, after if limit reached reallocate to double size vertexBufSize = mMaxVertices; const int sz = mMaxVertices * 4 + 30; - mFloatTexArray = new GLfloat[sz]; - mIntTexArray = new GLint[sz]; - mIntVertArray = new GLint[sz]; - mFloatTexArrayCached = new GLfloat[sz]; - mIntTexArrayCached = new GLint[sz]; - mIntVertArrayCached = new GLint[sz]; + if (!mFloatTexArray) + mFloatTexArray = new GLfloat[sz]; + if (!mIntTexArray) + mIntTexArray = new GLint[sz]; + if (!mIntVertArray) + mIntVertArray = new GLint[sz]; + if (!mFloatTexArrayCached) + mFloatTexArrayCached = new GLfloat[sz]; + if (!mIntTexArrayCached) + mIntTexArrayCached = new GLint[sz]; + if (!mIntVertArrayCached) + mIntVertArrayCached = new GLint[sz]; } bool NormalOpenGLGraphics::setVideoMode(const int w, const int h, diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index d09d7b13b..8782c9573 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -77,9 +77,12 @@ void NullOpenGLGraphics::initArrays() // need alocate small size, after if limit reached reallocate to double size vertexBufSize = mMaxVertices; const int sz = mMaxVertices * 4 + 30; - mFloatTexArray = new GLfloat[sz]; - mIntTexArray = new GLint[sz]; - mIntVertArray = new GLint[sz]; + if (!mFloatTexArray) + mFloatTexArray = new GLfloat[sz]; + if (!mIntTexArray) + mIntTexArray = new GLint[sz]; + if (!mIntVertArray) + mIntVertArray = new GLint[sz]; } bool NullOpenGLGraphics::setVideoMode(const int w, const int h, |