Author: matt
Date: 2009-06-30 06:38:52 -0700 (Tue, 30 Jun 2009)
New Revision: 6807
Log:
Fixed OpenGL shared context handling (STR #2135)
Modified:
branches/branch-1.1/CHANGES
branches/branch-1.1/src/Fl_Gl_Choice.cxx
branches/branch-1.1/src/Fl_Gl_Window.cxx
Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2009-06-30 13:38:45 UTC (rev 6806)
+++ branches/branch-1.1/CHANGES 2009-06-30 13:38:52 UTC (rev 6807)
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.1.10
+ - Fixed OpenGL shared context handling (STR #2135)
- Fixed gray-scale images with alpha channel (STR #2105)
- Fixed unexpected shortcut behavior for Win32 (STR #2199)
- Added cast to Fl_Color in all Fluid code (STR #2206)
Modified: branches/branch-1.1/src/Fl_Gl_Choice.cxx
===================================================================
--- branches/branch-1.1/src/Fl_Gl_Choice.cxx 2009-06-30 13:38:45 UTC (rev
6806)
+++ branches/branch-1.1/src/Fl_Gl_Choice.cxx 2009-06-30 13:38:52 UTC (rev
6807)
@@ -324,7 +324,7 @@
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);
}
@@ -333,7 +333,8 @@
# elif defined(__APPLE_QD__)
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,7 +350,8 @@
# 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);
@@ -365,7 +367,8 @@
# else
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);
@@ -414,9 +417,13 @@
# ifdef WIN32
wglMakeCurrent(0, 0);
# elif defined(__APPLE_QD__)
+ AGLContext ctx = aglGetCurrentContext();
+ if (ctx) aglSetDrawable(ctx, NULL);
aglSetCurrentContext(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
glXMakeCurrent(fl_display, 0, 0);
@@ -428,13 +435,9 @@
# ifdef WIN32
wglDeleteContext(context);
# elif defined(__APPLE_QD__)
- aglSetCurrentContext( NULL );
- aglSetDrawable( context, NULL );
aglDestroyContext( 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
glXDestroyContext(fl_display, context);
Modified: branches/branch-1.1/src/Fl_Gl_Window.cxx
===================================================================
--- branches/branch-1.1/src/Fl_Gl_Window.cxx 2009-06-30 13:38:45 UTC (rev
6806)
+++ branches/branch-1.1/src/Fl_Gl_Window.cxx 2009-06-30 13:38:52 UTC (rev
6807)
@@ -165,8 +165,8 @@
xywh[2] = w();
xywh[3] = h();
+ aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
aglEnable(context_, AGL_BUFFER_RECT);
- aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
// printf("make_current: xywh=[%d %d %d %d]\n", xywh[0], xywh[1], xywh[2],
xywh[3]);
#endif // __APPLE__
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit