Mercurial > octave-nkf
comparison libinterp/corefcn/gl2ps-renderer.h @ 20638:d30fc2c11455
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
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 11 Oct 2015 13:13:33 +0200 |
parents | 1784bf79ed43 |
children | 395140e53656 |
comparison
equal
deleted
inserted
replaced
20637:756b052037fb | 20638:d30fc2c11455 |
---|---|
34 OCTINTERP_API | 34 OCTINTERP_API |
35 glps_renderer : public opengl_renderer | 35 glps_renderer : public opengl_renderer |
36 { | 36 { |
37 public: | 37 public: |
38 glps_renderer (FILE *_fp, const std::string& _term) | 38 glps_renderer (FILE *_fp, const std::string& _term) |
39 : opengl_renderer () , fp (_fp), term (_term), fontsize (), fontname () { } | 39 : opengl_renderer () , fp (_fp), term (_term), fontsize (), |
40 fontname (), naxes (0) { } | |
40 | 41 |
41 ~glps_renderer (void) { } | 42 ~glps_renderer (void) { } |
42 | 43 |
43 void draw (const graphics_object& go, const std::string& print_cmd); | 44 void draw (const graphics_object& go, const std::string& print_cmd); |
44 | 45 |
47 Matrix render_text (const std::string& txt, | 48 Matrix render_text (const std::string& txt, |
48 double x, double y, double z, | 49 double x, double y, double z, |
49 int halign, int valign, double rotation = 0.0); | 50 int halign, int valign, double rotation = 0.0); |
50 | 51 |
51 void set_font (const base_properties& props); | 52 void set_font (const base_properties& props); |
53 | |
54 void draw_axes (const axes::properties& props) | |
55 { | |
56 // Finish previous sorting tree here, the last one will be closed | |
57 // by gl2psEndPage () | |
58 if (naxes++) | |
59 gl2psEndViewport (); | |
60 | |
61 // Initialize a sorting tree in gl2ps for each axes | |
62 GLint vp[4]; | |
63 glGetIntegerv (GL_VIEWPORT, vp); | |
64 gl2psBeginViewport (vp); | |
65 | |
66 // Draw and glFinish () or there may primitives missing in the | |
67 // gl2ps output. | |
68 opengl_renderer::draw_axes (props); | |
69 glFinish (); | |
70 } | |
52 | 71 |
53 void draw_text (const text::properties& props); | 72 void draw_text (const text::properties& props); |
54 void draw_pixels (GLsizei w, GLsizei h, GLenum format, | 73 void draw_pixels (GLsizei w, GLsizei h, GLenum format, |
55 GLenum type, const GLvoid *data); | 74 GLenum type, const GLvoid *data); |
56 | 75 |
87 int alignment_to_mode (int ha, int va) const; | 106 int alignment_to_mode (int ha, int va) const; |
88 FILE *fp; | 107 FILE *fp; |
89 caseless_str term; | 108 caseless_str term; |
90 double fontsize; | 109 double fontsize; |
91 std::string fontname; | 110 std::string fontname; |
111 int naxes; | |
92 }; | 112 }; |
93 | 113 |
94 #endif // HAVE_GL2PS_H | 114 #endif // HAVE_GL2PS_H |
95 | 115 |
96 extern OCTINTERP_API void | 116 extern OCTINTERP_API void |