summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2001-12-04 04:12:58 +0000
committerMatthias Melcher <fltk@matthiasm.com>2001-12-04 04:12:58 +0000
commit1acca043df8b51b419db822fa580cb9635c5e235 (patch)
tree9452e9474072d9492a0bd560d37441a359d8936a /src
parent1d06051e8c1769e2fead7ef38c7beff65d899b42 (diff)
Some Win32 drivers would draw into wrong buffers
after OpenGL mode change. After changing from single- to doublebuffered OpenGL, glClear would write into the FRONbuffer and swap_buffers would not send a glFlush(). (nVidia GeForce2 MX/MX 400, 2560x1024 pixel, 16bit) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1805 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Gl_Window.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index 9e185ccf3..31142185c 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.22.2.1 2001/11/27 17:44:06 easysw Exp $"
+// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.2 2001/12/04 04:12:58 matthiaswm Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@@ -85,15 +85,21 @@ void Fl_Gl_Window::invalidate() {
int Fl_Gl_Window::mode(int m, const int *a) {
if (m == mode_ && a == alist) return 0;
-#if !defined(WIN32) && !defined(__APPLE__)
+#if !defined(__APPLE__)
int oldmode = mode_;
Fl_Gl_Choice* oldg = g;
#endif
context(0);
mode_ = m; alist = a;
if (shown()) {
- g = Fl_Gl_Choice::find(m, a);
-#if !defined(WIN32) && !defined(__APPLE__)
+ g = Fl_Gl_Choice::find(m, a);
+#ifdef WIN32
+ if (!g || (oldmode^m)&FL_DOUBLE) {
+ hide();
+ show();
+ }
+#endif
+#if !defined(WIN32) && !defined(__APPLE__)
// under X, if the visual changes we must make a new X window (yuck!):
if (!g || g->vis->visualid!=oldg->vis->visualid || (oldmode^m)&FL_DOUBLE) {
hide();
@@ -144,7 +150,8 @@ void Fl_Gl_Window::swap_buffers() {
#ifdef WIN32
# if HAVE_GL_OVERLAY
// Do not swap the overlay, to match GLX:
- wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_MAIN_PLANE);
+ BOOL ret = wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_MAIN_PLANE);
+ DWORD err = GetLastError();;
# else
SwapBuffers(Fl_X::i(this)->private_dc);
# endif
@@ -340,5 +347,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
-// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.1 2001/11/27 17:44:06 easysw Exp $".
+// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.2 2001/12/04 04:12:58 matthiaswm Exp $".
//