Hi,

> I said:
>
> > > Note also that you have to have *at least* one window mapped before
> > > you create your first offscreen context, because it uses the mapped
> > > window to ascertain the correct rendering properties. I'm
> > not sure if
> > > that is documented or anything, it is just what I discovered trying
> > > to use them...
>
>
> Fabio said:
>
> > I'm trying to set up a small example program to play with the
> > offscreen.
> > I found a old one from Lukasz  (May 03), but I don't get the
> > point in deriving your own box and your own window.
> > I'm trying to use a standard window, but I don't even succeed
> > in opening/closing the offscreen: the program crashes just at
> > fl_begin_offscreen. What am I doing wrong here actually? I
> > haven't drawn a single widget yet ... see my small program:
> > int main( ) {
> >    Fl_Double_Window *aWin = new Fl_Double_Window( 400, 400,
> > "Fl_Offscreen test" );
> >   aWin->show( );
> >   std::cout << "Fl_Double_Window started" << std::endl;
> >   Fl_Offscreen scr;
> >   scr = fl_create_offscreen( 200, 200 );
>
>
> There's your problem. See my note above.
>
> You need to have a window mapped before you can create your offscreen.
> So you need to show your aWin object, and wait until it has actually
> been established, before you can safely create the offscreen context.

This is one of the points I don't get: I first create a window and then I show 
it, isn't this just enough to have a window mapped?
or maybe I should force the window creation by Fl::flush() ?
And a more fundamental remark is: why isnn't such a offscreen totally 
independent of the widgets, visualized or not?

> You are probably best deriving a viewer widget of your own, say derived
> from Fl_Box or similar, and from within its draw method, the first time
> it is called, you can then safely create your offscreen. You can be
> sure, if the draw() method is called, that the object is mapped to the
> display.

Aha, I see. well, this looks to me as a workaround. Is this the only way to go? 
I already developed a quite complex system, It doesn't feel right to manipulate 
again the callbacks of my already complex widget structure ...

> I'm fairly sure I posted examples of this in the past - but I take it
> they were not found?
> If I can find the examples at home, I'll try and post them later on.

I'm analyzing your example now, indeed there was just that example from Lukasz 
in the general forum.

/F

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

Reply via email to