Mercurial > octave
diff libinterp/corefcn/gl2ps-renderer.cc @ 18958:c9f960441513
Overhaul FLTK plotting and printing
* gl2ps-renderer.cc: Force execution of GL commands before gl2psEndPage to
avoid missing primitives in output. Enable error output of gl2ps,
check return value of gl2psBeginPage for error.
* __init_fltk__.cc:
Avoid redraw of the OpenGL and the plot window if not needed.
Let FLTK do the resizing of the canvas, the menubar and the statusbar.
This was done by creating a resize_dummy and set this as resizable
for the plot_window group. Previously this was done inside draw().
Avoid timing issues with fltk_maxtime (removed) and other hacks with
multiple Fl::check and redraw () calls. You can use flush and glFlush
if you really need to force a immediate redraw.
Remove print_mode in draw () and print directly without waiting that
FLTK flushes its buffers. This fixes bug #42458 and #40215
Manually placement of the toolbar is only done once when hiding or
showing the menubar. (update_toolbar_position)
set(gcf, "position", [x, y, w, h]) is now handled by
figure::properties::ID_POSITION which calls update_position
* __add_default_menu__.m: Remove now unneeded hacks for the menubar.
author | Andreas Weber <andy.weber.aw@gmail.com> |
---|---|
date | Sat, 26 Jul 2014 10:09:48 +0200 |
parents | 333901476119 |
children | 1288a2f27769 |
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-renderer.cc Thu Jul 24 17:37:45 2014 +0100 +++ b/libinterp/corefcn/gl2ps-renderer.cc Sat Jul 26 10:09:48 2014 +0200 @@ -59,7 +59,7 @@ else if (term.find ("tex") != std::string::npos) gl2ps_term = GL2PS_TEX; else { - error ("gl2ps-renderer:: Unknown terminal"); + error ("gl2ps-renderer::draw: Unknown terminal %s", term.c_str ()); return; } @@ -95,16 +95,25 @@ else include_graph = "foobar-inc"; buffsize += 1024*1024; - gl2psBeginPage ("glps_renderer figure", "Octave", viewport, - gl2ps_term, gl2ps_sort, - (GL2PS_SILENT - | GL2PS_NO_BLENDING | GL2PS_OCCLUSION_CULL - | GL2PS_BEST_ROOT | gl2ps_text - | GL2PS_NO_PS3_SHADING), - GL_RGBA, 0, NULL, 0, 0, 0, - buffsize, fp, include_graph.c_str ()); + // GL2PS_SILENT was removed to allow gl2ps printing errors on stderr + GLint ret = gl2psBeginPage ("glps_renderer figure", "Octave", viewport, + gl2ps_term, gl2ps_sort, + ( GL2PS_NO_BLENDING + | GL2PS_OCCLUSION_CULL + | GL2PS_BEST_ROOT + | gl2ps_text + | GL2PS_NO_PS3_SHADING), + GL_RGBA, 0, NULL, 0, 0, 0, + buffsize, fp, include_graph.c_str ()); + if (ret == GL2PS_ERROR) + error ("gl2ps-renderer::draw: gl2psBeginPage returned GL2PS_ERROR"); old_print_cmd = print_cmd; opengl_renderer::draw (go); + + // Force execution of GL commands in finite time. + // Without glFlush () there may primitives be missing in the gl2ps output. + glFlush (); + state = gl2psEndPage (); } @@ -200,7 +209,7 @@ // Convert to GL_FLOAT as it is the only type gl2ps accepts. for (int i = 0; i < 3*w*h; i++) a[i] = data[i] / maxval; - + gl2psDrawPixels (w, h, 0, 0, format, GL_FLOAT, a); }