# HG changeset patch # User Pantxo Diribarne # Date 1428609574 -7200 # Node ID 438485f6a47951319d410fea89c684ec6944805c # Parent cbba639b956bdde9886427393506d19e2230954e 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. diff -r cbba639b956b -r 438485f6a479 libinterp/corefcn/gl-render.cc --- 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); diff -r cbba639b956b -r 438485f6a479 libinterp/corefcn/gl2ps-renderer.h --- 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);