On 17.03.2010, at 21:53, manolo gouy wrote: > Matt: > > I've just committed Albrecht's patch that in my hands is necessary > and sufficient to force loading of Fl_Gl_Device_Plugin when > fltk_gl is loaded, and thus to have Fl_printer::print_widget() > print correctly GL windows on MSWindows. Checked that the cube and > glpuzzle demos work well under MSWindows. > > I have also sorted out how to capture a GL window obscured > by the print dialog window. > > Could you, please, see if this is a good patch, and clarify why > Albrecht does not get correct GL printing in his msys build ?
Not much time tonight :-( This all must be an overzealous linker trying to optimize much more than it should. The plugins work like this: even before main() is called, all global variables are initialized. This must be done for *every* global class. In the last line of Fl_Gl_Device_Plugin.cxx, I instantiate such a global class: static Fl_Gl_Device_Plugin Gl_Device_Plugin; Maybe the "static" keyword confuses the linker, thinking that simply because the class is not used, that it's not needed - which of course is wrong, because instantiating the class creates an entry in a RAM based preferences database for later access. Our function "print_gl_window" is called by the plugin. So as long as the plugin is not "optimized" out, the function shouldn't be either. So on Linux and MSWindows, please remove the "trick" as well as the "static" keyword and let me know if this now works. Fl_Plugin should create this: // before even main() is called: Fl_Plugin: creating a plugin, class "fltk:device", name "opengl.device.fltk.org" Fl_Plugin: creating a plugin manager for class "fltk:device" Fl_Plugin: adding plugin named "opengl.device.fltk.org" at 0x0x175314 Fl_Plugin: deleting a plugin manager // as soon as the window is printed Fl_Plugin: creating a plugin manager for class "fltk:device" Fl_Plugin: returning plugin named "opengl.device.fltk.org": 0x0x175314 Fl_Plugin: deleting a plugin manager // when quitting the app Fl_Plugin: deleting a plugin _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
