summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Choice.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Gl_Choice.cxx')
-rw-r--r--src/Fl_Gl_Choice.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index 041d4e2aa..a4531c20a 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -263,7 +263,8 @@ static void del_context(GLContext ctx) {
#if defined(USE_X11)
GLContext fl_create_gl_context(XVisualInfo* vis) {
- GLContext shared_ctx = context_list ? context_list[0] : 0;
+ GLContext shared_ctx = 0;
+ if (context_list && nContext) shared_context = context_list[0];
GLContext context = glXCreateContext(fl_display, vis, shared_ctx, 1);
if (context)
add_context(context);
@@ -286,7 +287,7 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
GLContext context =
layer ? wglCreateLayerContext(hdc, layer) : wglCreateContext(hdc);
if (context) {
- if (context_list && context_list[0])
+ if (context_list && nContext)
wglShareLists(context_list[0], context);
add_context(context);
}
@@ -296,7 +297,8 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
# elif defined(__APPLE_QUARTZ__)
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
- GLContext context, shared_ctx = context_list ? context_list[0] : 0;
+ GLContext context, shared_ctx = 0;
+ if (context_list && nContext) shared_ctx = context_list[0];
context = aglCreateContext( g->pixelformat, shared_ctx);
if (!context) return 0;
add_context((GLContext)context);
@@ -349,6 +351,8 @@ void fl_no_gl_context() {
wglMakeCurrent(0, 0);
# elif defined(__APPLE_QUARTZ__)
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
+ AGLContext ctx = aglGetCurrentContext();
+ if (ctx) aglSetDrawable(ctx, NULL);
aglSetCurrentContext(0);
# else
# error unsupported platform
@@ -363,8 +367,6 @@ void fl_delete_gl_context(GLContext context) {
wglDeleteContext(context);
# elif defined(__APPLE_QUARTZ__)
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
- aglSetCurrentContext( NULL );
- aglSetDrawable( context, NULL );
aglDestroyContext( context );
# else
# error unsupported platform