+#if defined(DCPOMATIC_OSX)
+ /* Without this we see errors like
+ * ../src/osx/cocoa/glcanvas.mm(194): assert ""context"" failed in SwapBuffers(): should have current context [in thread 700006970000]
+ */
+ WXGLSetCurrentContext (_context->GetWXGLContext());
+#else
+ /* We must call this here on Linux otherwise we get no image (for reasons
+ * that aren't clear). However, doing ensure_context() from this thread
+ * on macOS gives
+ * "[NSOpenGLContext setView:] must be called from the main thread".
+ */
+ ensure_context ();
+#endif
+ }