changeset 20090:438485f6a479

Honor the axes stack order in gl2ps outputs (bug #44765) * gl2ps-renderer.h (glps_renderer::draw_axes): new method to init a new sorting tree in gl2ps each time a new axes is drawn before calling opengl_renderer::draw_axes. * gl-render.cc (opengl_renderer::draw_axes_planes): don't draw xz and yz planes when in 2D mode.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 09 Apr 2015 21:59:34 +0200
parents cbba639b956b
children df3244834a50
files libinterp/corefcn/gl-render.cc libinterp/corefcn/gl2ps-renderer.h
diffstat 2 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Thu Apr 09 13:54:07 2015 -0400
+++ b/libinterp/corefcn/gl-render.cc	Thu Apr 09 21:59:34 2015 +0200
@@ -870,6 +870,7 @@
   double xPlaneN = props.get_xPlaneN ();
   double yPlaneN = props.get_yPlaneN ();
   double zPlaneN = props.get_zPlaneN ();
+  bool is2d = props.get_is2D ();
 
   // Axes planes
   set_color (axe_color);
@@ -877,17 +878,20 @@
 
   glBegin (GL_QUADS);
 
-  // X plane
-  glVertex3d (xPlane, yPlaneN, zPlaneN);
-  glVertex3d (xPlane, yPlane, zPlaneN);
-  glVertex3d (xPlane, yPlane, zPlane);
-  glVertex3d (xPlane, yPlaneN, zPlane);
-
-  // Y plane
-  glVertex3d (xPlaneN, yPlane, zPlaneN);
-  glVertex3d (xPlane, yPlane, zPlaneN);
-  glVertex3d (xPlane, yPlane, zPlane);
-  glVertex3d (xPlaneN, yPlane, zPlane);
+  if (! is2d)
+    {
+      // X plane
+      glVertex3d (xPlane, yPlaneN, zPlaneN);
+      glVertex3d (xPlane, yPlane, zPlaneN);
+      glVertex3d (xPlane, yPlane, zPlane);
+      glVertex3d (xPlane, yPlaneN, zPlane);
+
+      // Y plane
+      glVertex3d (xPlaneN, yPlane, zPlaneN);
+      glVertex3d (xPlane, yPlane, zPlaneN);
+      glVertex3d (xPlane, yPlane, zPlane);
+      glVertex3d (xPlaneN, yPlane, zPlane);
+    }
 
   // Z plane
   glVertex3d (xPlaneN, yPlaneN, zPlane);
--- a/libinterp/corefcn/gl2ps-renderer.h	Thu Apr 09 13:54:07 2015 -0400
+++ b/libinterp/corefcn/gl2ps-renderer.h	Thu Apr 09 21:59:34 2015 +0200
@@ -54,6 +54,19 @@
   void draw_pixels (GLsizei w, GLsizei h, GLenum format,
                     GLenum type, const GLvoid *data);
 
+  void draw_axes (const axes::properties& props)
+  {
+    // Initialize a new sorting tree in gl2ps, this will make subsequent 
+    // objects be drawn over previous ones
+    GLint vp[4];
+    gl2psEndViewport ();
+    glGetIntegerv(GL_VIEWPORT, vp);
+    gl2psBeginViewport (vp);
+
+    opengl_renderer::draw_axes (props);
+  }
+
+
   void set_linestyle (const std::string& s, bool use_stipple = false)
   {
     opengl_renderer::set_linestyle (s, use_stipple);