changeset 24837:ae6679369a80

Rely on QOffscreenSurface functionality rather than its presence (bug #53278) * acinclude.m4: Define HAVE_QT_OFFSCREEN if QOffscreenSurface is functional * getframe.m: rely on HAVE_QT_OFFSCREEN rather than HAVE_QOFFSCREENSURFACE * __opengl_print__.m: Ditto * GLCanvas.h/cc: Ditto
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 04 Mar 2018 22:01:00 +0100
parents fd3edb183ee2
children 08a591a59a95
files libgui/graphics/GLCanvas.cc libgui/graphics/GLCanvas.h m4/acinclude.m4 scripts/image/getframe.m scripts/plot/util/private/__opengl_print__.m
diffstat 5 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/GLCanvas.cc	Mon Mar 05 20:29:24 2018 +0100
+++ b/libgui/graphics/GLCanvas.cc	Sun Mar 04 22:01:00 2018 +0100
@@ -283,7 +283,7 @@
     
     if (! isValid ())
       {
-#  if defined (HAVE_QOFFSCREENSURFACE)
+#  if defined (HAVE_QT_OFFSCREEN)
         static bool os_ctx_ok = true;
         if (os_ctx_ok && ! m_os_context.isValid ())
           {
--- a/libgui/graphics/GLCanvas.h	Mon Mar 05 20:29:24 2018 +0100
+++ b/libgui/graphics/GLCanvas.h	Sun Mar 04 22:01:00 2018 +0100
@@ -28,7 +28,7 @@
 #  define OCTAVE_QT_OPENGL_WIDGET QOpenGLWidget
 #  include <QOpenGLFramebufferObject>
 #  define OCTAVE_QT_OPENGL_FBO QOpenGLFramebufferObject
-#  if defined (HAVE_QOFFSCREENSURFACE)
+#  if defined (HAVE_QT_OFFSCREEN)
 #    include <QOpenGLContext>
 #    include <QOffscreenSurface>
 #  endif  
@@ -80,7 +80,7 @@
     bool begin_rendering (void);
     void end_rendering (void);
 
-# if defined (HAVE_QOFFSCREENSURFACE)
+# if defined (HAVE_QT_OFFSCREEN)
     QOpenGLContext m_os_context;    
     QOffscreenSurface m_os_surface;
 # endif
--- a/m4/acinclude.m4	Mon Mar 05 20:29:24 2018 +0100
+++ b/m4/acinclude.m4	Sun Mar 04 22:01:00 2018 +0100
@@ -2016,8 +2016,11 @@
         [warn_qt_opengl="Qt does not work with the OpenGL libs (GL and GLU); disabling OpenGL graphics with Qt GUI"])
 
       if test $build_qt_graphics = yes; then
+        AC_DEFINE(HAVE_QT_GRAPHICS, 1, [Define to 1 if Qt works with OpenGL libs (GL and GLU)])
         OCTAVE_CHECK_QT_OPENGL_OFFSCREEN_OK([have_qt_opengl_offscreen=yes])
-        AC_DEFINE(HAVE_QT_GRAPHICS, 1, [Define to 1 if Qt works with OpenGL libs (GL and GLU)])
+        if test $have_qt_opengl_offscreen = yes; then
+          AC_DEFINE(HAVE_QT_OFFSCREEN, 1, [Define to 1 if Qt handles offscreen OpenGL rendering])
+        fi
       fi
     fi
 
--- a/scripts/image/getframe.m	Mon Mar 05 20:29:24 2018 +0100
+++ b/scripts/image/getframe.m	Sun Mar 04 22:01:00 2018 +0100
@@ -98,7 +98,7 @@
   if (strcmp (get (hf, "visible"), "on")
       || (strcmp (get (hf, "__graphics_toolkit__"), "qt")
           && (strcmp (get (hf, "__gl_window__"), "on")
-              || __have_feature__ ("QOFFSCREENSURFACE"))))
+              || __have_feature__ ("QT_OFFSCREEN"))))
     cdata = __get_frame__ (hf);
   else
     ## Use OpenGL offscreen rendering with OSMesa for non-visible figures
@@ -162,7 +162,7 @@
 %! image (frame.cdata);
 %! title ("Lower left hand corner");
 
-%!testif HAVE_QOFFSCREENSURFACE
+%!testif HAVE_QT_OFFSCREEN
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   pos = get (hf, "position");
@@ -171,7 +171,7 @@
 %!   close (hf);
 %! end_unwind_protect
 
-%!testif HAVE_QOFFSCREENSURFACE
+%!testif HAVE_QT_OFFSCREEN
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   hax = axes ("visible", "off", "position", [0 0 1 1]);
--- a/scripts/plot/util/private/__opengl_print__.m	Mon Mar 05 20:29:24 2018 +0100
+++ b/scripts/plot/util/private/__opengl_print__.m	Sun Mar 04 22:01:00 2018 +0100
@@ -153,7 +153,7 @@
     if (strcmp (get (opts.figure, "visible"), "on")
         || (strcmp (get (opts.figure, "__graphics_toolkit__"), "qt")
             && (strcmp (get (opts.figure, "__gl_window__"), "on")
-                || __have_feature__ ("QOFFSCREENSURFACE"))))
+                || __have_feature__ ("QT_OFFSCREEN"))))
       ## Use toolkits "print_figure" method
       drawnow (gl2ps_device{n}, ['|' pipeline{n}]);
     else