On 14 Jan 2013, at 20:10, Christopher James Huff wrote: > On 2013-01-13 17:32:52 -0500, Ian MacArthur said: > >> But I think an actual GL driver layer would work better... Though >> handling of fonts might always be problematic - drawing TT fonts in >> Windows GL is actually easier. MS did do some useful things after all! > > I've now got a very incomplete but working implementation of an OpenGL > driver for FLTK3: > https://github.com/cjameshuff/fltkstuff > > It's not clear how to actually *use* a different graphics driver, I'm > simply swapping my driver into fltk3::graphics_driver when drawing the > window, but this seems unlikely to be the correct way...suggestions? I > use the existing FLTK font stuff.
Best bet might be to see if we can get some input from Manolo here - he's did a lot of work on the driver layer, particularly when getting the printing support and etc. working, so he might have the clearest suggestions. > Is there an easy way to render a "standard" window to an image? It'd > greatly streamline testing if I could do comparisons in the app itself. It's pretty easy to make a group that just renders to an offscreen buffer, then blit that buffer content onto another surface for display... I'll dig about, I think I have code for that somewhere... > > There's also code for retrofitting FLTK with support for some C++11 > features, in particular lambdas for callbacks and event handlers. The > OpenGL driver doesn't depend on this, but it may be of interest. Yes, we talked a bit about lambdas, but the feeling was that they aren't an instant win for us, and there's always the portability issue. Maintaining portability, particularly when we have to play well with the MS tools, and various embedded toolchains, means a pretty conservative "lowest common denominator" approach plays out best. Anyway, here's a possible offscreen example - it's not the one I was thinking of, must be on a different machine, but the idea is the same! -------- /* Re: capture widget image -> minimal example "MacArthur, Ian (SELEX GALILEO, UK)" Feb 10, 2009 http://www.fltk.org/newsgroups.php?gfltk.general+v:27474 */ // offscreen-grab.cxx // fltk-config --compile offscreen-grab.cxx #include <FL/Fl.H> #include <FL/x.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Group.H> #include <FL/Fl_Button.H> #include <FL/Fl_Scroll.H> #include <Fl/fl_draw.h> // #include "write_png.h" Fl_Offscreen offscr = 0; int offscrW = 750; int offscrH = 750; class offscreen_group : public Fl_Group { protected: void draw( ); public: offscreen_group(int X, int Y, int W, int H) : Fl_Group(X,Y,W,H) { } }; void offscreen_group::draw() { int wo = w(); int ho = h(); if (!offscr) offscr = fl_create_offscreen(offscrW, offscrH); if(!offscr) return; // create must have failed! fl_begin_offscreen(offscr); // draw the widget hierarchy of this group into the offscreen Fl_Group::draw(); fl_end_offscreen(); // copy the offscreen back onto this window... fl_copy_offscreen(0, 0, wo, ho, offscr, 0, 0); } /*****************************************************************************/ uchar *data_p = NULL; static void cb_bt_grab(Fl_Button*, void*) { if(offscr) { // offscreen exists, grab something if(data_p){ delete[] data_p; data_p = NULL; } fl_begin_offscreen(offscr); /* Open the offscreen context for reading */ data_p = fl_read_image(data_p, 0, 0, offscrW, offscrH, 0); // write_png("Test2.png", data_p, offscrW, offscrH, 3, "meta-data", "comment"); fl_end_offscreen(); // close the offscreen context } } // cb_bt_grab /*****************************************************************************/ int main(int argc, char **argv) { Fl_Double_Window *main_win = new Fl_Double_Window(450, 430, "Fl_Offscreen group test"); main_win->begin(); Fl_Button *grab_bt = new Fl_Button(405, 405, 40, 20, "Grab"); grab_bt->callback((Fl_Callback*)cb_bt_grab); Fl_Scroll *scroller = new Fl_Scroll(0,0,400,400); scroller->begin(); offscreen_group *osg = new offscreen_group(0, 0, offscrW, offscrH); osg->begin(); osg->box(FL_FLAT_BOX); int a = 40, b = 40; Fl_Button *b0; while ((a + 60) < offscrW) { b0 = new Fl_Button( a, b, 60, 60, "BUTTON"); a += 60; b += 60; } osg->end(); scroller->end(); main_win->end(); main_win->resizable(scroller); main_win->show(argc, argv); return Fl::run( ); } /* end of file */ _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

