diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-23 12:07:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-23 12:08:54 +0300 |
commit | 906332df8779bca71641c6bcdc84d04a1de6d2eb (patch) | |
tree | 3571dab23663919ed9c6536c19ba14e850ab4581 /src/render/normalopenglgraphics.cpp | |
parent | dee232be436909e84a39e9bc3e8949dbaba38e05 (diff) | |
download | manaverse-906332df8779bca71641c6bcdc84d04a1de6d2eb.tar.gz manaverse-906332df8779bca71641c6bcdc84d04a1de6d2eb.tar.bz2 manaverse-906332df8779bca71641c6bcdc84d04a1de6d2eb.tar.xz manaverse-906332df8779bca71641c6bcdc84d04a1de6d2eb.zip |
Add functions for resize batch size (OpenGL).
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, |