From 7ad6bc89291c198122f087a11fd9ab585ea87034 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sat, 11 Aug 2012 01:52:35 +0300
Subject: Some changes in screenshot code.

---
 src/graphicsmanager.cpp | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

(limited to 'src/graphicsmanager.cpp')

diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index b14ec1688..14ea31447 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -196,6 +196,24 @@ void GraphicsManager::initGraphics(bool noOpenGL)
 #endif
 }
 
+Graphics *GraphicsManager::createGraphics()
+{
+#ifdef USE_OPENGL
+    switch (config.getIntValue("opengl"))
+    {
+        case 0:
+            return new Graphics;
+        case 1:
+        default:
+            return new NormalOpenGLGraphics;
+        case 2:
+            return new SafeOpenGLGraphics;
+    };
+#else
+    return new Graphics;
+#endif
+}
+
 void GraphicsManager::updateExtensions(const char *extensions)
 {
     mExtensions.clear();
@@ -355,14 +373,14 @@ void GraphicsManager::createFBO(int width, int height, FBOInfo *fbo)
 
     // create a texture object
     glGenTextures(1, &fbo->textureId);
-    glBindTexture(GL_TEXTURE_2D, fbo->textureId);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0,
+    glBindTexture(OpenGLImageHelper::mTextureType, fbo->textureId);
+    glTexParameterf(OpenGLImageHelper::mTextureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameterf(OpenGLImageHelper::mTextureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameterf(OpenGLImageHelper::mTextureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameterf(OpenGLImageHelper::mTextureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    glTexImage2D(OpenGLImageHelper::mTextureType, 0, GL_RGBA8, width, height, 0,
         GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
-    glBindTexture(GL_TEXTURE_2D, 0);
+    glBindTexture(OpenGLImageHelper::mTextureType, 0);
 
     // create a renderbuffer object to store depth info
     mglGenRenderbuffers(1, &fbo->rboId);
@@ -377,7 +395,7 @@ void GraphicsManager::createFBO(int width, int height, FBOInfo *fbo)
 
     // attach the texture to FBO color attachment point
     mglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-        GL_TEXTURE_2D, fbo->textureId, 0);
+        OpenGLImageHelper::mTextureType, fbo->textureId, 0);
 
     // attach the renderbuffer to depth attachment point
     mglFramebufferRenderbuffer(GL_FRAMEBUFFER,
-- 
cgit v1.2.3-70-g09d2