# HG changeset patch # User Pantxo Diribarne # Date 1444562013 -7200 # Node ID d30fc2c11455090af938df4a0cee044e58bf2752 # Parent 756b052037fb9480866bcb1cb06a9fcf2ef863f8 Fix missing legend background in gl2ps outputs (bug #44765) * gl2ps-render.h (glps_renderer): new private attribute "naxes" used to count drawn axes * gl2ps-renderer.h (glps_renderer::draw_axes): new overloaded method. Use gl2psBegin(End) viewport to Finalize/Initialize a new viewport each time an axes is drawn. This is supposed to mimic "glClear (... GL_DEPTH_BUFFER_BIT)" in opengl_renderer::draw_axes diff -r 756b052037fb -r d30fc2c11455 libinterp/corefcn/gl2ps-renderer.h --- a/libinterp/corefcn/gl2ps-renderer.h Sun Oct 11 20:39:11 2015 +0200 +++ b/libinterp/corefcn/gl2ps-renderer.h Sun Oct 11 13:13:33 2015 +0200 @@ -36,7 +36,8 @@ { public: glps_renderer (FILE *_fp, const std::string& _term) - : opengl_renderer () , fp (_fp), term (_term), fontsize (), fontname () { } + : opengl_renderer () , fp (_fp), term (_term), fontsize (), + fontname (), naxes (0) { } ~glps_renderer (void) { } @@ -50,6 +51,24 @@ void set_font (const base_properties& props); + void draw_axes (const axes::properties& props) + { + // Finish previous sorting tree here, the last one will be closed + // by gl2psEndPage () + if (naxes++) + gl2psEndViewport (); + + // Initialize a sorting tree in gl2ps for each axes + GLint vp[4]; + glGetIntegerv (GL_VIEWPORT, vp); + gl2psBeginViewport (vp); + + // Draw and glFinish () or there may primitives missing in the + // gl2ps output. + opengl_renderer::draw_axes (props); + glFinish (); + } + void draw_text (const text::properties& props); void draw_pixels (GLsizei w, GLsizei h, GLenum format, GLenum type, const GLvoid *data); @@ -89,6 +108,7 @@ caseless_str term; double fontsize; std::string fontname; + int naxes; }; #endif // HAVE_GL2PS_H