Mercurial > octave
changeset 23215:0842b119dc1b stable
Fix opengl "invalid operation" when zooming (bug #50317)
* GLCanvas.cc (drawZoomBox): push and pop matrix for both MODELVIEW and
PROJECTION. Call glLineWidth outside glBegin/End block.
* __init_fltk__.cc (OpenGL_fltk::overlay): same as above
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 19 Feb 2017 20:44:38 +0100 |
parents | 76a894168fe5 |
children | 54404cc32903 |
files | libgui/graphics/GLCanvas.cc libinterp/dldfcn/__init_fltk__.cc |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/GLCanvas.cc Tue Feb 21 14:55:34 2017 +0100 +++ b/libgui/graphics/GLCanvas.cc Sun Feb 19 20:44:38 2017 +0100 @@ -114,12 +114,12 @@ void GLCanvas::drawZoomBox (const QPoint& p1, const QPoint& p2) { + glMatrixMode (GL_MODELVIEW); glPushMatrix (); - - glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glMatrixMode (GL_PROJECTION); + glPushMatrix (); glLoadIdentity (); glOrtho (0, width (), height (), 0, 1, -1); @@ -131,13 +131,18 @@ glDrawZoomBox (p1, p2); glEnd (); + glLineWidth (1.5); glBegin (GL_LINE_STRIP); - glLineWidth (1.5); glColor4f (0.45, 0.62, 0.81, 0.9); glDrawZoomBox (p1, p2); glEnd (); glPopAttrib (); + + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + + glMatrixMode (GL_PROJECTION); glPopMatrix (); }
--- a/libinterp/dldfcn/__init_fltk__.cc Tue Feb 21 14:55:34 2017 +0100 +++ b/libinterp/dldfcn/__init_fltk__.cc Sun Feb 19 20:44:38 2017 +0100 @@ -222,12 +222,12 @@ { #if defined (HAVE_OPENGL) + glMatrixMode (GL_MODELVIEW); glPushMatrix (); - - glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glMatrixMode (GL_PROJECTION); + glPushMatrix (); glLoadIdentity (); gluOrtho2D (0.0, w (), 0.0, h ()); @@ -239,13 +239,16 @@ zoom_box_vertex (); glEnd (); + glLineWidth (1.5); glBegin (GL_LINE_STRIP); - glLineWidth (1.5); glColor4f (0.45, 0.62, 0.81, 0.9); zoom_box_vertex (); glEnd (); glPopAttrib (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + glMatrixMode (GL_PROJECTION); glPopMatrix (); #else