summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/graphics.cpp29
-rw-r--r--src/render/graphics.h2
-rw-r--r--src/render/mgldefines.h6
-rw-r--r--src/render/mobileopenglgraphics.cpp13
-rw-r--r--src/render/modernopenglgraphics.cpp19
-rw-r--r--src/render/normalopenglgraphics.cpp11
-rw-r--r--src/render/safeopenglgraphics.cpp8
7 files changed, 43 insertions, 45 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 4c5d1d282..2a835aeeb 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -80,6 +80,7 @@
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#endif
+#include "render/mgldefines.h"
#endif
#include "debug.h"
@@ -638,3 +639,31 @@ const ClipRect *Graphics::getCurrentClipArea() const
return &mClipStack.top();
}
+
+#ifdef USE_OPENGL
+void Graphics::setOpenGLFlags()
+{
+ glEnable(GL_SCISSOR_TEST);
+
+ glDisable(GL_MULTISAMPLE);
+ glDisable(GL_DITHER);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_POLYGON_SMOOTH);
+ glDisable(GL_STENCIL_TEST);
+ glDisable(GL_COLOR_LOGIC_OP);
+ glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
+ glDisable(GL_DEPTH_CLAMP);
+ glDisable(GL_RASTERIZER_DISCARD);
+ glDisable(GL_SAMPLE_MASK);
+
+#ifndef ANDROID
+#ifndef __MINGW32__
+ glHint(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
+#endif
+#endif
+ glHint(GL_TEXTURE_COMPRESSION_HINT_ARB, GL_FASTEST);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+}
+#endif
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 3a051ed55..e6fc44865 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -505,6 +505,8 @@ class Graphics notfinal
#ifdef USE_OPENGL
virtual void createGLContext();
+
+ void setOpenGLFlags();
#endif
/**
* Holds the clip area stack.
diff --git a/src/render/mgldefines.h b/src/render/mgldefines.h
index d42dca853..3185e856b 100644
--- a/src/render/mgldefines.h
+++ b/src/render/mgldefines.h
@@ -92,6 +92,12 @@
#define GL_INFO_LOG_LENGTH 0x8B84
#endif
+#ifndef GL_DEPTH_CLAMP
+#define GL_DEPTH_CLAMP 0x864F
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_SAMPLE_MASK 0x8E51
+#endif
+
#endif // USE_OPENGL
#endif // RENDER_MGLDEFINES_H
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index a38a291be..b0e78c534 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -886,19 +886,13 @@ void MobileOpenGLGraphics::beginDraw()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glEnable(GL_SCISSOR_TEST);
- glDisable(GL_DITHER);
+ setOpenGLFlags();
glDisable(GL_LIGHTING);
- glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
- glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_STENCIL_TEST);
glShadeModel(GL_FLAT);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -907,13 +901,8 @@ void MobileOpenGLGraphics::beginDraw()
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
-#ifndef __MINGW32__
- glHint(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
-#endif
#endif
-// glScalef(0.5F, 0.5F, 0.5F);
-
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 231f83a67..e8d0756cf 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -840,22 +840,9 @@ void ModernOpenGLGraphics::updateScreen()
void ModernOpenGLGraphics::beginDraw()
{
- glEnable(GL_SCISSOR_TEST);
- glDisable(GL_DITHER);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_POLYGON_SMOOTH);
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-#ifndef ANDROID
-#ifndef __MINGW32__
- glHint(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
-#endif
-#endif
-
+ setOpenGLFlags();
+ glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
+ glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, GL_FASTEST);
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 43191d369..f32003d49 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -1222,16 +1222,10 @@ void NormalOpenGLGraphics::beginDraw()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glEnable(GL_SCISSOR_TEST);
- glDisable(GL_DITHER);
+ setOpenGLFlags();
glDisable(GL_LIGHTING);
- glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
- glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_STENCIL_TEST);
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -1245,9 +1239,6 @@ void NormalOpenGLGraphics::beginDraw()
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
-#ifndef __MINGW32__
- glHint(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
-#endif
#endif
pushClipArea(Rect(0, 0, w, h));
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index c67b84377..1f381b2b9 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -492,19 +492,13 @@ void SafeOpenGLGraphics::beginDraw()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glEnable(GL_SCISSOR_TEST);
- glDisable(GL_DITHER);
+ setOpenGLFlags();
glDisable(GL_LIGHTING);
- glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
- glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_STENCIL_TEST);
glShadeModel(GL_FLAT);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}