Shai Ayal wrote:

> I want to force an unconditional redraw, which does not depend on any
> external events (e.g. it should work even if the window is hidden) the
> next time fl::flush is called. I understand this is not exactly
> consistent with fltk's philosophy, but is there a way?

The consistent way is to "damage" the widget/window to force a redraw.
You can do

   gl_window->damage(FL_DAMAGE_ALL);

That's exactly what

   gl_window->redraw();

would do. But I suspect that this doesn't work if the gl window is
hidden.

> I'm using fltk to draw figures for GNU Octave, using OpenGL. I also
> need to produce "hardcopy" (i.e. a postscript file) of the figure. I
> do this by using the gl2ps library. I need to redraw to get the file,
> and this has to be done even if fltk does not think it really has to
> redraw.

Which FLTK version are you using? FLTK 1.3 can do this for you with
its new Fl_Printer, Fl_PostScript_Printer, and Fl_PostScript_File_Device
features. However, AFAICT, this would also only work for shown and
fully visible GL windows.

Note: the following is just an educated guess, but you could try it
anyway if your GL window is hidden:

   Fl::flush();                 // draw everything on screen
   gl_window->redraw();         // set damage(FL_DAMAGE_ALL)
   gl_window->make_current();   // set drawing context
   gl_window->draw();           // call drawing method directly

This is officially *not* recommended and I don't know if it would work,
but it's short and maybe worth a try. At least I'd assume that the
GL window must have been shown once before to create the GL context,
but that's also only a guess.

And finally, there's also set_visible() and clear_visible() to set
and clear (fake) the window's "visible()" status, but it's totally
unsupported to do it this way. But maybe...

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to