diff --git a/android/jni/com/mapswithme/maps/Lifecycle.cpp b/android/jni/com/mapswithme/maps/Lifecycle.cpp index 3db7bc1207..add919608e 100644 --- a/android/jni/com/mapswithme/maps/Lifecycle.cpp +++ b/android/jni/com/mapswithme/maps/Lifecycle.cpp @@ -71,11 +71,11 @@ bool ShutdownGLESResources() { NVDEBUG("ShutdownGLESResources: GLES not bound, shutting down EGL to release"); - yg::gl::g_doDeleteOnDestroy = false; + yg::gl::g_hasContext = false; g_framework->DeleteRenderPolicy(); - yg::gl::g_doDeleteOnDestroy = true; + yg::gl::g_hasContext = true; NVDEBUG("Cleaning up EGL"); diff --git a/yg/base_texture.cpp b/yg/base_texture.cpp index f68857058f..6515337e80 100644 --- a/yg/base_texture.cpp +++ b/yg/base_texture.cpp @@ -36,7 +36,7 @@ namespace yg BaseTexture::~BaseTexture() { - if (g_doDeleteOnDestroy) + if (g_hasContext) OGLCHECK(glDeleteTextures(1, &m_id)); } diff --git a/yg/framebuffer.cpp b/yg/framebuffer.cpp index 66db4a05fa..ae6c69a811 100644 --- a/yg/framebuffer.cpp +++ b/yg/framebuffer.cpp @@ -32,7 +32,7 @@ namespace yg FrameBuffer::~FrameBuffer() { - if ((m_id != 0) && g_doDeleteOnDestroy) + if ((m_id != 0) && g_hasContext) OGLCHECK(glDeleteFramebuffersFn(1, &m_id)); } diff --git a/yg/indexbuffer.cpp b/yg/indexbuffer.cpp index 8eb20f5c86..218ae5db90 100644 --- a/yg/indexbuffer.cpp +++ b/yg/indexbuffer.cpp @@ -56,7 +56,7 @@ namespace yg IndexBuffer::~IndexBuffer() { - if ((!m_useVA) && (g_doDeleteOnDestroy)) + if ((!m_useVA) && (g_hasContext)) OGLCHECK(glDeleteBuffersFn(1, &m_id)); } diff --git a/yg/internal/opengl.cpp b/yg/internal/opengl.cpp index 4aea5b113c..a6768587fd 100644 --- a/yg/internal/opengl.cpp +++ b/yg/internal/opengl.cpp @@ -85,7 +85,7 @@ namespace yg void (OPENGL_CALLING_CONVENTION * glBlendFuncSeparateFn) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); - bool g_doDeleteOnDestroy = true; + bool g_hasContext = true; bool g_doLogOGLCalls = false; void CheckExtensionSupport() diff --git a/yg/internal/opengl.hpp b/yg/internal/opengl.hpp index 21c4cbffbe..24017a3c80 100644 --- a/yg/internal/opengl.hpp +++ b/yg/internal/opengl.hpp @@ -111,7 +111,7 @@ namespace yg /// In this case we should set this variable to true to correctly deletes all our wrapper /// classes without calls to glDeleteXXX. - extern bool g_doDeleteOnDestroy; + extern bool g_hasContext; /// This flag controls, whether the OGLCHECK macroses should log OGL calls. /// This is for debugging purpose only. @@ -159,8 +159,7 @@ namespace yg #endif #else - #define OGLCHECK(f) f - #define OGLCHECKAFTER - #define EGLCHECK - +#define OGLCHECK(f) f +#define OGLCHECKAFTER +#define EGLCHECK #endif diff --git a/yg/renderbuffer.cpp b/yg/renderbuffer.cpp index 63f73d68d1..2dc70ea41c 100644 --- a/yg/renderbuffer.cpp +++ b/yg/renderbuffer.cpp @@ -58,7 +58,7 @@ namespace yg RenderBuffer::~RenderBuffer() { - if (g_doDeleteOnDestroy) + if (g_hasContext) { // if(m_isDepthBuffer) // OGLCHECK(glDeleteTextures(1, &m_id)); diff --git a/yg/vertexbuffer.cpp b/yg/vertexbuffer.cpp index 39d16501f3..b9537b8c7b 100644 --- a/yg/vertexbuffer.cpp +++ b/yg/vertexbuffer.cpp @@ -58,7 +58,7 @@ namespace yg VertexBuffer::~VertexBuffer() { - if ((!m_useVA) && (g_doDeleteOnDestroy)) + if ((!m_useVA) && (g_hasContext)) OGLCHECK(glDeleteBuffersFn(1, &m_id)); }