From 636fedff122dc254ec77ea5504cf8d94acd8b351 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Wed, 10 Sep 2014 14:24:29 -0400 Subject: make context active before clearing buffers --- common/headless_view.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/headless_view.cpp') diff --git a/common/headless_view.cpp b/common/headless_view.cpp index f790d90cec..0fce223986 100644 --- a/common/headless_view.cpp +++ b/common/headless_view.cpp @@ -113,6 +113,8 @@ void HeadlessView::resize(int width, int height) { } void HeadlessView::clear_buffers() { + make_active(); + #if MBGL_USE_CGL glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -- cgit v1.2.1 From c836bc2b01c1c8642875d86126c1ef2a76dfd359 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Wed, 10 Sep 2014 15:11:17 -0400 Subject: Revert "make context active before clearing buffers" This reverts commit 636fedff122dc254ec77ea5504cf8d94acd8b351. --- common/headless_view.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'common/headless_view.cpp') diff --git a/common/headless_view.cpp b/common/headless_view.cpp index 0fce223986..f790d90cec 100644 --- a/common/headless_view.cpp +++ b/common/headless_view.cpp @@ -113,8 +113,6 @@ void HeadlessView::resize(int width, int height) { } void HeadlessView::clear_buffers() { - make_active(); - #if MBGL_USE_CGL glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -- cgit v1.2.1 From c004c036964e9012b08aa4a2f8b16094630d62be Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Tue, 24 Jun 2014 00:25:20 +1000 Subject: Add View::make_inactive() to remove context from rendering thread View::make_inactive() is called just before termination of the rendering thread. The implementation must clear the thread's GL context. This ensures there is no context still bound to a thread during GL shutdown. This is needed as GL will not actually delete a context until it is not active on any thread. Fixes mapbox/mapbox-gl-native#340 Conflicts: common/glfw_view.hpp include/llmr/map/view.hpp test/headless.cpp --- common/headless_view.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common/headless_view.cpp') diff --git a/common/headless_view.cpp b/common/headless_view.cpp index f790d90cec..34326ae29c 100644 --- a/common/headless_view.cpp +++ b/common/headless_view.cpp @@ -179,6 +179,19 @@ void HeadlessView::make_active() { #endif } +void HeadlessView::make_inactive() { +#if MBGL_USE_CGL + CGLError error = CGLSetCurrentContext(nullptr); + if (error) { + fprintf(stderr, "Removing OpenGL context failed\n"); + } +#endif + +#if MBGL_USE_GLX + // no-op +#endif +} + void HeadlessView::swap() {} unsigned int HeadlessView::root_fbo() { -- cgit v1.2.1