mirror of
https://github.com/fltk/fltk.git
synced 2026-05-27 19:10:24 +08:00
Fixed OpenGL shared context handling (STR #2135)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6806 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
CHANGES IN FLTK 1.3.0
|
CHANGES IN FLTK 1.3.0
|
||||||
|
|
||||||
|
- Fixed OpenGL shared context handling (STR #2135)
|
||||||
- Fixed gray-scale images with alpha channel (STR #2105)
|
- Fixed gray-scale images with alpha channel (STR #2105)
|
||||||
- Fixed unexpected shortcut behavior for Win32 (STR #2199)
|
- Fixed unexpected shortcut behavior for Win32 (STR #2199)
|
||||||
- Fixed documentation for Fl_Progress (STR #2209)
|
- Fixed documentation for Fl_Progress (STR #2209)
|
||||||
|
|||||||
@@ -263,7 +263,8 @@ static void del_context(GLContext ctx) {
|
|||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
|
|
||||||
GLContext fl_create_gl_context(XVisualInfo* vis) {
|
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);
|
GLContext context = glXCreateContext(fl_display, vis, shared_ctx, 1);
|
||||||
if (context)
|
if (context)
|
||||||
add_context(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 =
|
GLContext context =
|
||||||
layer ? wglCreateLayerContext(hdc, layer) : wglCreateContext(hdc);
|
layer ? wglCreateLayerContext(hdc, layer) : wglCreateContext(hdc);
|
||||||
if (context) {
|
if (context) {
|
||||||
if (context_list && context_list[0])
|
if (context_list && nContext)
|
||||||
wglShareLists(context_list[0], context);
|
wglShareLists(context_list[0], context);
|
||||||
add_context(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__)
|
# elif defined(__APPLE_QUARTZ__)
|
||||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
// 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 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);
|
context = aglCreateContext( g->pixelformat, shared_ctx);
|
||||||
if (!context) return 0;
|
if (!context) return 0;
|
||||||
add_context((GLContext)context);
|
add_context((GLContext)context);
|
||||||
@@ -349,6 +351,8 @@ void fl_no_gl_context() {
|
|||||||
wglMakeCurrent(0, 0);
|
wglMakeCurrent(0, 0);
|
||||||
# elif defined(__APPLE_QUARTZ__)
|
# elif defined(__APPLE_QUARTZ__)
|
||||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||||
|
AGLContext ctx = aglGetCurrentContext();
|
||||||
|
if (ctx) aglSetDrawable(ctx, NULL);
|
||||||
aglSetCurrentContext(0);
|
aglSetCurrentContext(0);
|
||||||
# else
|
# else
|
||||||
# error unsupported platform
|
# error unsupported platform
|
||||||
@@ -363,8 +367,6 @@ void fl_delete_gl_context(GLContext context) {
|
|||||||
wglDeleteContext(context);
|
wglDeleteContext(context);
|
||||||
# elif defined(__APPLE_QUARTZ__)
|
# elif defined(__APPLE_QUARTZ__)
|
||||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||||
aglSetCurrentContext( NULL );
|
|
||||||
aglSetDrawable( context, NULL );
|
|
||||||
aglDestroyContext( context );
|
aglDestroyContext( context );
|
||||||
# else
|
# else
|
||||||
# error unsupported platform
|
# error unsupported platform
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ void Fl_Gl_Window::make_current() {
|
|||||||
xywh[2] = w();
|
xywh[2] = w();
|
||||||
xywh[3] = h();
|
xywh[3] = h();
|
||||||
|
|
||||||
aglEnable(context_, AGL_BUFFER_RECT);
|
|
||||||
aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
|
aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
|
||||||
|
aglEnable(context_, AGL_BUFFER_RECT);
|
||||||
// printf("make_current: xywh=[%d %d %d %d]\n", xywh[0], xywh[1], xywh[2], xywh[3]);
|
// printf("make_current: xywh=[%d %d %d %d]\n", xywh[0], xywh[1], xywh[2], xywh[3]);
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user