summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2000-01-12 06:06:24 +0000
committerBill Spitzak <spitzak@gmail.com>2000-01-12 06:06:24 +0000
commitb45efe96dc8138f2a3cba84d4b5416472f34091e (patch)
tree42f716554e244e476bf5c906b2914594685a577e /src
parent0bdb9aba797ad98ea09e56a264e73ca326f939cb (diff)
Fixed the gl_overlay demo (and gl overlays in general) when they are
faked with no hardware and the window is resized. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@984 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Gl_Window.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index 9f4648910..ab3b0d4c1 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.5 1999/12/19 05:32:34 bill Exp $"
+// "$Id: Fl_Gl_Window.cxx,v 1.12.2.6 2000/01/12 06:06:24 bill Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@@ -199,8 +199,10 @@ void Fl_Gl_Window::flush() {
if (overlay == this) { // Use CopyPixels to act like SWAP_TYPE == COPY
+ uchar save_valid = valid_;
// don't draw if only the overlay is damaged:
if (damage1_ || damage() != FL_DAMAGE_OVERLAY || !valid()) draw();
+
// we use a seperate context for the copy because rasterpos must be 0
// and depth test needs to be off:
static GLXContext ortho_context;
@@ -212,10 +214,14 @@ void Fl_Gl_Window::flush() {
ortho_context = glXCreateContext(fl_display,g->vis,fl_first_context,1);
#endif
fl_set_gl_context(this, ortho_context);
- if (init) {
+ if (init || !save_valid) {
glDisable(GL_DEPTH_TEST);
glReadBuffer(GL_BACK);
glDrawBuffer(GL_FRONT);
+ glLoadIdentity();
+ glViewport(0, 0, w(), h());
+ glOrtho(0, w(), 0, h(), -1, 1);
+ glRasterPos2i(0,0);
}
glCopyPixels(0,0,w(),h(),GL_COLOR);
make_current(); // set current context back to draw overlay
@@ -316,5 +322,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
-// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.5 1999/12/19 05:32:34 bill Exp $".
+// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.6 2000/01/12 06:06:24 bill Exp $".
//