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.
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.
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.
>
> std::cout << "Fl_Offscreen created" << std::endl;
>
> fl_begin_offscreen( scr );
>
> fl_end_offscreen( );
>
> return Fl::run( );
> }
SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk