On 24/05/2011 13:06, Matthias Melcher wrote:

> 
> 
> Maybe the overlay API was not available when this was written. Seriously 
> though, the overlay stuff is about 10 years old, and I seriously doubt that 
> any of this is still current. If the OP really needs overlay panes under 
> Cygwin, I would recommend to change the flag and test the results. If it 
> works well (which is hard to test, because different graphics cards and 
> drivers will behave differently) we should consider a patch for 1.3.1 or 
> later.
> 

Possibly, and I was digging into it because I have found an overlay glitch - 
which I have resolved now. It seems like a bug of Intel's GL driver for Windows 
7
(and possibly Vista), other graphics (ATI/AMD, nVidia, or even Intel on XP) 
work fine.

The bug is weird  as the 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), which was commented 
out in
1.1.x (and is uncommented in 1.3, I have put the comment back again...)

My resolution to it is setting it 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 new code should be correct (and should be also slightly 
faster). Here is what I did:


ORIGINAL CODE, Fl_Fl_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



After that, everything seems to work fine.

Shall I fill an STR?

R.








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

Reply via email to