DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2663
Version: 1.3-current


Sometimes the opengl overlay is not redrawn when running on intel graphics
on Windows 7 (and possibly Vista). You can see the bug running
gl_overlay.exe from test directory: when you change number of vertices (or
overlay vertices), the overlay either disappears or is nor redrawn. It is
correctly redrawn only after you resize the window.
Tested on 4 machines with Win7+IntelGr, all expose this behavior. ATI and
nVidia work fine. The same applies for fltk-1.1.10 (all compiled with
mingw)


After investigating the behavior I have found that ortho_context (which is
only used to copy back buffer to front to emulate overlay) does not like
repetitive setting of glReadBuffer(GL_BACK); glDrawBuffer(GL_FRONT); in
which case overlay is not displayed.
It also does not like glRasterPos2i(0,0).
Apthough it seems like intel driver bug, there are so many win7+Intel
boxes so I think we can not ignore the problem. I have tried many driver
versions, all of them - including newest ones - have this problem.


My resolution to it is setting read/draw buffers within this static
ortho_context only once when this context is created. As this context is
used only for the back/front buffer copy and never changes (apart from
viewport), the code should be correct (maybe even slightly faster). I have
also commented out glRasterPos2i(0,0) again. 

After that, everything works fine (tested on several win7 machines I have
around - with Intel, ATI and nVidia chips, also on older XPs it works
fine).


Here is the code change:


ORIGINAL CODE, Fl_Gl_Window.cxx staring at line 372:

        if (orthoinit) ortho_context = fl_create_gl_context(this, g);
        fl_set_gl_context(this, ortho_context);
        if (orthoinit || !save_valid || ortho_window != this) {
          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);
          ortho_window = this;
        }
        glCopyPixels(0,0,w(),h(),GL_COLOR);
        make_current(); // set current context back to draw overlay


NEW CODE which suppresses the bug:

        if (orthoinit){
          ortho_context = fl_create_gl_context(this, g);
          fl_set_gl_context(this, ortho_context);
          glDisable(GL_DEPTH_TEST);
          glReadBuffer(GL_BACK);
          glDrawBuffer(GL_FRONT);
          glLoadIdentity();
        }else
          fl_set_gl_context(this, ortho_context);
        if (orthoinit || !save_valid || ortho_window != this) {
          glViewport(0, 0, w(), h());
          glOrtho(0, w(), 0, h(), -1, 1);
          // glRasterPos2i(0,0);   // <- commenting it out again...
          ortho_window = this;
        }
        glCopyPixels(0,0,w(),h(),GL_COLOR);
        make_current(); // set current context back to draw overlay


Roman.


Link: http://www.fltk.org/str.php?L2663
Version: 1.3-current

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to