diff options
| author | Bill Spitzak <spitzak@gmail.com> | 2000-04-07 16:55:46 +0000 |
|---|---|---|
| committer | Bill Spitzak <spitzak@gmail.com> | 2000-04-07 16:55:46 +0000 |
| commit | 177e3cd076288531a1bee16374a091aed80e61a6 (patch) | |
| tree | 3bee32fbbda8ee41c4ec7eabf51b37331fd7d32c | |
| parent | bf34ed8ca79d200f5a5069bddf0e553abb0d1bbe (diff) | |
More fixes to the NT OpenGL overlays
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1058 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_Gl_Overlay.cxx | 24 | ||||
| -rw-r--r-- | src/Fl_Gl_Window.cxx | 57 |
2 files changed, 46 insertions, 35 deletions
diff --git a/src/Fl_Gl_Overlay.cxx b/src/Fl_Gl_Overlay.cxx index 05cfce859..8021851d4 100644 --- a/src/Fl_Gl_Overlay.cxx +++ b/src/Fl_Gl_Overlay.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.6 2000/03/24 08:55:34 bill Exp $" +// "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.7 2000/04/07 16:55:45 bill Exp $" // // OpenGL overlay code for the Fast Light Tool Kit (FLTK). // @@ -34,7 +34,7 @@ #if HAVE_GL_OVERLAY -#ifndef WIN32 +#ifndef _WIN32 // Methods on Fl_Gl_Window that create an overlay window. Because // many programs don't need the overlay, this is seperated into this @@ -101,14 +101,14 @@ int Fl_Gl_Window::can_do_overlay() { return fl_find_overlay_visual() != 0; } -#else // WIN32: +#else // _WIN32: int Fl_Gl_Window::can_do_overlay() { Fl_Gl_Choice* choice = Fl_Gl_Choice::find(0,0); return (choice && (choice->pfd.bReserved & 15)); } -int fl_overlay_depth = 0; +extern int fl_overlay_depth; #endif @@ -121,12 +121,10 @@ int Fl_Gl_Window::can_do_overlay() {return 0;} void Fl_Gl_Window::make_overlay() { if (!overlay) { #if HAVE_GL_OVERLAY -#ifdef WIN32 +#ifdef _WIN32 HDC hdc = fl_private_dc(this, mode_,&g); GLXContext context = wglCreateLayerContext(hdc, 1); - if (!context) { - ; // no overlay hardware - } else { + if (context) { // we found a usable overlay context if (fl_first_context) wglShareLists(fl_first_context, context); else fl_first_context = context; overlay = context; @@ -172,7 +170,7 @@ void Fl_Gl_Window::make_overlay() { void Fl_Gl_Window::redraw_overlay() { if (!shown()) return; make_overlay(); -#ifndef WIN32 +#ifndef _WIN32 if (overlay != this) ((Fl_Gl_Window*)overlay)->redraw(); else @@ -184,10 +182,10 @@ void Fl_Gl_Window::make_overlay_current() { make_overlay(); #if HAVE_GL_OVERLAY if (overlay != this) { -#ifdef WIN32 +#ifdef _WIN32 fl_set_gl_context(this, (GLXContext)overlay); if (fl_overlay_depth) - wglRealizeLayerPalette(fl_private_dc(this, mode_,&g), 1, TRUE); + wglRealizeLayerPalette(Fl_X::i(this)->private_dc, 1, TRUE); #else ((Fl_Gl_Window*)overlay)->make_current(); #endif @@ -198,7 +196,7 @@ void Fl_Gl_Window::make_overlay_current() { void Fl_Gl_Window::hide_overlay() { #if HAVE_GL_OVERLAY -#ifdef WIN32 +#ifdef _WIN32 // nothing needs to be done? Or should it be erased? #else if (overlay && overlay!=this) ((Fl_Gl_Window*)overlay)->hide(); @@ -209,5 +207,5 @@ void Fl_Gl_Window::hide_overlay() { #endif // -// End of "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.6 2000/03/24 08:55:34 bill Exp $". +// End of "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.7 2000/04/07 16:55:45 bill Exp $". // diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 601f73404..5af5bc41c 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.9 2000/03/24 08:42:02 bill Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.12.2.10 2000/04/07 16:55:46 bill Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -66,7 +66,7 @@ int Fl_Gl_Window::can_do(int a, const int *b) { } void Fl_Gl_Window::show() { -#ifndef WIN32 +#ifndef _WIN32 if (!shown()) { if (!g) { g = Fl_Gl_Choice::find(mode_,alist); @@ -81,7 +81,7 @@ void Fl_Gl_Window::show() { void Fl_Gl_Window::invalidate() { valid(0); -#ifndef WIN32 +#ifndef _WIN32 if (overlay) ((Fl_Gl_Window*)overlay)->valid(0); #endif } @@ -89,7 +89,7 @@ void Fl_Gl_Window::invalidate() { int Fl_Gl_Window::mode(int m, const int *a) { if (m == mode_ && a == alist) return 0; mode_ = m; alist = a; -#ifdef WIN32 +#ifdef _WIN32 // destroy context and g: if (shown()) {hide(); show();} #else @@ -107,7 +107,7 @@ int Fl_Gl_Window::mode(int m, const int *a) { void Fl_Gl_Window::make_current() { if (!context) { -#ifdef WIN32 +#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; @@ -118,7 +118,7 @@ void Fl_Gl_Window::make_current() { valid(0); } fl_set_gl_context(this, (GLXContext)context); -#if defined(WIN32) && USE_COLORMAP +#if defined(_WIN32) && USE_COLORMAP if (fl_palette) { fl_GetDC(fl_xid(this)); SelectPalette(fl_gc, fl_palette, FALSE); @@ -144,27 +144,33 @@ void Fl_Gl_Window::ortho() { } void Fl_Gl_Window::swap_buffers() { -#ifdef WIN32 +#ifdef _WIN32 SwapBuffers(Fl_X::i(this)->private_dc); #else glXSwapBuffers(fl_display, fl_xid(this)); #endif } -#if defined(_WIN32) && HAVE_GL_OVERLAY +#if HAVE_GL_OVERLAY && defined(_WIN32) uchar fl_overlay; // changes how fl_color() works +int fl_overlay_depth = 0; #endif void Fl_Gl_Window::flush() { uchar save_valid = valid_; -#if defined(_WIN32) && HAVE_GL_OVERLAY +#if HAVE_GL_OVERLAY && defined(_WIN32) + bool fixcursor = false; if (overlay && overlay != this && ((damage()&(FL_DAMAGE_OVERLAY|FL_DAMAGE_ALL|FL_DAMAGE_EXPOSE)) || !save_valid)) { + // SGI 320 messes up overlay over singlebuffer + fixcursor = !g->d; + if (fixcursor) SetCursor(0); // Draw into hardware overlay planes - if (!g->d) SetCursor(0); // SGI 320 messes up overlay over singlebuffer fl_set_gl_context(this, (GLXContext)overlay); + if (fl_overlay_depth) + wglRealizeLayerPalette(Fl_X::i(this)->private_dc, 1, TRUE); glDisable(GL_SCISSOR_TEST); glClear(GL_COLOR_BUFFER_BIT); fl_overlay = 1; @@ -173,10 +179,9 @@ void Fl_Gl_Window::flush() { valid(save_valid); if (damage() == FL_DAMAGE_OVERLAY) { wglSwapLayerBuffers(Fl_X::i(this)->private_dc,WGL_SWAP_OVERLAY1); - if (!g->d) SetCursor(Fl_X::i(this)->cursor); + if (fixcursor) SetCursor(Fl_X::i(this)->cursor); return; } - if (!g->d) SetCursor(Fl_X::i(this)->cursor); } #endif @@ -207,12 +212,13 @@ void Fl_Gl_Window::flush() { static GLXContext ortho_context = 0; static Fl_Gl_Window* ortho_window = 0; int init = !ortho_context; -#ifdef WIN32 - if (init) ortho_context = wglCreateContext(Fl_X::i(this)->private_dc); + if (init) { +#ifdef _WIN32 + ortho_context = wglCreateContext(Fl_X::i(this)->private_dc); #else - if (init) ortho_context = glXCreateContext(fl_display,g->vis,fl_first_context,1); #endif + } fl_set_gl_context(this, ortho_context); if (init || !save_valid || ortho_window != this) { glDisable(GL_DEPTH_TEST); @@ -256,7 +262,9 @@ void Fl_Gl_Window::flush() { draw(); if (overlay == this) draw_overlay(); glFlush(); - +#if HAVE_GL_OVERLAY && defined(_WIN32) + if (fixcursor) SetCursor(Fl_X::i(this)->cursor); +#endif } valid(1); @@ -270,19 +278,24 @@ 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 - if (context && context != fl_first_context) + if (context != fl_first_context) { +#ifdef _WIN32 wglDeleteContext((GLXContext)context); - g = 0; #else - if (context != fl_first_context) glXDestroyContext(fl_display, (GLXContext)context); +#endif + } #ifdef GLX_MESA_release_buffers glXReleaseBuffersMESA(fl_display, fl_xid(this)); #endif -#endif context = 0; } +#if HAVE_GL_OVERLAY && defined(_WIN32) + if (overlay && overlay != this && (GLXContext)overlay != fl_first_context) { + wglDeleteContext((GLXContext)overlay); + overlay = 0; + } +#endif Fl_Window::hide(); } @@ -307,5 +320,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.9 2000/03/24 08:42:02 bill Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.10 2000/04/07 16:55:46 bill Exp $". // |
