From 62a416d5585106c2ce8e2259036740e7ba2c70c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Jul 2014 19:20:41 +0300 Subject: Improve initial OpenGL state. Moved shared code into separate method. --- src/render/graphics.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/render/graphics.cpp') 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 #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 -- cgit v1.2.3-70-g09d2