diff options
Diffstat (limited to 'src/render/normalopenglgraphics.cpp')
-rw-r--r-- | src/render/normalopenglgraphics.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
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, |