summaryrefslogtreecommitdiff
path: root/src/graphicsmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-11 01:52:35 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-13 22:17:00 +0300
commit7ad6bc89291c198122f087a11fd9ab585ea87034 (patch)
tree5b88547634c99dfd549b50fe3491e56a71f48304 /src/graphicsmanager.cpp
parent4e12e0514a3ade4f693c49353c369028481999d1 (diff)
downloadmanaverse-7ad6bc89291c198122f087a11fd9ab585ea87034.tar.gz
manaverse-7ad6bc89291c198122f087a11fd9ab585ea87034.tar.bz2
manaverse-7ad6bc89291c198122f087a11fd9ab585ea87034.tar.xz
manaverse-7ad6bc89291c198122f087a11fd9ab585ea87034.zip
Some changes in screenshot code.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r--src/graphicsmanager.cpp34
1 files changed, 26 insertions, 8 deletions
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,