diff options
Diffstat (limited to 'src/Fl_Gl_Window.cxx')
| -rw-r--r-- | src/Fl_Gl_Window.cxx | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 7b1a21ebb..5b20d60d2 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.cxx,v 1.12.2.2 1999/08/09 06:19:32 bill Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.12.2.3 1999/09/16 05:34:25 bill Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -107,8 +107,6 @@ void Fl_Gl_Window::invalidate() { #endif } -extern GLXContext fl_first_context; // in Fl_Gl_Choice.C - int Fl_Gl_Window::mode(int m, const int *a) { if (m == mode_ && a == alist) return 0; mode_ = m; alist = a; @@ -129,33 +127,25 @@ int Fl_Gl_Window::mode(int m, const int *a) { } void Fl_Gl_Window::make_current() { -#ifdef WIN32 - HDC hdc = fl_private_dc(this, mode_,&g); - if (!context) { - context = wglCreateContext(hdc); +#ifdef WIN32 + context = wglCreateContext(fl_private_dc(this, mode_,&g)); if (fl_first_context) wglShareLists(fl_first_context, (GLXContext)context); else fl_first_context = (GLXContext)context; +#else + context = glXCreateContext(fl_display, g->vis, fl_first_context, 1); + if (!fl_first_context) fl_first_context = (GLXContext)context; +#endif valid(0); } - wglMakeCurrent(hdc, (GLXContext)context); - -# if USE_COLORMAP + fl_set_gl_context(this, (GLXContext)context); +#if defined(WIN32) && USE_COLORMAP if (fl_palette) { fl_GetDC(fl_xid(this)); SelectPalette(fl_gc, fl_palette, FALSE); RealizePalette(fl_gc); } -# endif // USE_COLORMAP -#else - if (!context) { - context = glXCreateContext(fl_display, g->vis, fl_first_context, 1); - if (!fl_first_context) fl_first_context = (GLXContext)context; - valid(0); - } - glXMakeCurrent(fl_display, fl_xid(this), (GLXContext)context); -#endif - +#endif // USE_COLORMAP glDrawBuffer(GL_BACK); } @@ -215,12 +205,11 @@ void Fl_Gl_Window::flush() { int init = !ortho_context; #ifdef WIN32 if (init) ortho_context = wglCreateContext(Fl_X::i(this)->private_dc); - wglMakeCurrent(Fl_X::i(this)->private_dc, ortho_context); #else if (init) ortho_context = glXCreateContext(fl_display,g->vis,fl_first_context,1); - glXMakeCurrent(fl_display, fl_xid(this), ortho_context); #endif + fl_set_gl_context(this, ortho_context); if (init) { glDisable(GL_DEPTH_TEST); glReadBuffer(GL_BACK); @@ -266,7 +255,7 @@ void Fl_Gl_Window::flush() { if (overlay && overlay != this) { DRAW_OVERLAY_ONLY: valid_ = save_valid; - wglMakeCurrent(Fl_X::i(this)->private_dc, (GLXContext)overlay); + fl_set_gl_context(this, (GLXContext)overlay); glDisable(GL_SCISSOR_TEST); fl_overlay = 1; glClear(GL_COLOR_BUFFER_BIT); @@ -287,13 +276,12 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) { void Fl_Gl_Window::hide() { if (context) { + fl_no_gl_context(); #ifdef WIN32 - wglMakeCurrent(0, 0); if (context && context != fl_first_context) wglDeleteContext((GLXContext)context); g = 0; #else - glXMakeCurrent(fl_display, 0, 0); if (context != fl_first_context) glXDestroyContext(fl_display, (GLXContext)context); #ifdef GLX_MESA_release_buffers @@ -326,5 +314,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.2 1999/08/09 06:19:32 bill Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.3 1999/09/16 05:34:25 bill Exp $". // |
