From 906332df8779bca71641c6bcdc84d04a1de6d2eb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 23 May 2014 12:07:25 +0300 Subject: Add functions for resize batch size (OpenGL). --- src/render/normalopenglgraphics.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/render/normalopenglgraphics.cpp') diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 75064a435..c7b01c4d2 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -115,17 +115,12 @@ NormalOpenGLGraphics::NormalOpenGLGraphics(): NormalOpenGLGraphics::~NormalOpenGLGraphics() { - delete [] mFloatTexArray; - delete [] mIntTexArray; - delete [] mIntVertArray; - delete [] mFloatTexArrayCached; - delete [] mIntTexArrayCached; - delete [] mIntVertArrayCached; + deleteArraysInternal(); } -void NormalOpenGLGraphics::initArrays() +void NormalOpenGLGraphics::initArrays(const int vertCount) { - mMaxVertices = graphicsManager.getMaxVertices(); + mMaxVertices = vertCount; if (mMaxVertices < 500) mMaxVertices = 500; else if (mMaxVertices > 1024) @@ -148,6 +143,27 @@ void NormalOpenGLGraphics::initArrays() mIntVertArrayCached = new GLint[sz]; } +void NormalOpenGLGraphics::deleteArrays() +{ + deleteArraysInternal(); +} + +void NormalOpenGLGraphics::deleteArraysInternal() +{ + delete [] mFloatTexArray; + mFloatTexArray = nullptr; + delete [] mIntTexArray; + mIntTexArray = nullptr; + delete [] mIntVertArray; + mIntVertArray = nullptr; + delete [] mFloatTexArrayCached; + mFloatTexArrayCached = nullptr; + delete [] mIntTexArrayCached; + mIntTexArrayCached = nullptr; + delete [] mIntVertArrayCached; + mIntVertArrayCached = nullptr; +} + bool NormalOpenGLGraphics::setVideoMode(const int w, const int h, const int scale, const int bpp, -- cgit v1.2.3-60-g2f50