summaryrefslogtreecommitdiff
path: root/src/graphicsmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r--src/graphicsmanager.cpp36
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
+}