diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-09 13:09:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-11 00:20:47 +0300 |
commit | 0f6fcf759a1a02c1dd8955971d54395e0d529244 (patch) | |
tree | 1ed3705938a7c9c61b81c0d1b9019949cf6bef6d /src/graphicsmanager.cpp | |
parent | 3e6e18339748880c2038e1ea63ea36c540288f3c (diff) | |
download | plus-0f6fcf759a1a02c1dd8955971d54395e0d529244.tar.gz plus-0f6fcf759a1a02c1dd8955971d54395e0d529244.tar.bz2 plus-0f6fcf759a1a02c1dd8955971d54395e0d529244.tar.xz plus-0f6fcf759a1a02c1dd8955971d54395e0d529244.zip |
switch to hardware depend batch sizes.
but limit max batch size to 1024.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r-- | src/graphicsmanager.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 86814b4be..66502434d 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -54,7 +54,8 @@ GraphicsManager::GraphicsManager() : mMinor(0), mMajor(0), mPlatformMinor(0), - mPlatformMajor(0) + mPlatformMajor(0), + mMaxVertices(500) { } @@ -80,10 +81,8 @@ bool GraphicsManager::detectGraphics() logger->log("enable opengl mode"); SDL_SetVideoMode(100, 100, 0, SDL_ANYFORMAT | SDL_OPENGL); - setGLVersion(); - initOpenGLFunctions(); - updateExtensions(); - updatePlanformExtensions(); + initOpenGL(); + std::string vendor = getGLString(GL_VENDOR); std::string renderer = getGLString(GL_RENDERER); logger->log("gl vendor: %s", vendor.c_str()); @@ -598,3 +597,30 @@ void GraphicsManager::initOpenGLFunctions() #endif #endif } + +void GraphicsManager::updateLimits() +{ +#ifdef USE_OPENGL + GLint value; + glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &value); + logger->log("GL_MAX_ELEMENTS_VERTICES: %d", value); + + mMaxVertices = value; + + glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &value); + logger->log("GL_MAX_ELEMENTS_INDICES: %d", value); + if (value < mMaxVertices) + mMaxVertices = value; +#endif +} + +void GraphicsManager::initOpenGL() +{ +#ifdef USE_OPENGL + setGLVersion(); + initOpenGLFunctions(); + updateExtensions(); + updatePlanformExtensions(); + updateLimits(); +#endif +} |