I'm on holiday this week, but might grab my linux machine from the office if I get bored as I'd like to help with the canvas implementation.
Hopefully you won't need ANY opengl on your end as AttachGraphics takes an xwindow handle and flags, this is the relevant code from fltkgadget, hopefully you can create a panel with it's own xwindow and be away.
fltk needed some nasty cludging to get a colormap/visual combo which I think had to be shared by all contexts, but i think you will be fine ignoring that.
ps I found hidegadget more troublesome to implement than freegadget
Hopefully you won't need ANY opengl on your end as AttachGraphics takes an xwindow handle and flags, this is the relevant code from fltkgadget, hopefully you can create a panel with it's own xwindow and be away.
' canvas Field driver$ Field canvas:TGraphics Field canvasflags Method AttachGraphics:TGraphics( flags ) canvasflags=flags End Method Method CanvasGraphics:TGraphics() If Not canvas canvas=brl.graphics.AttachGraphics( flCanvasWindow(flhandle),canvasflags ) EndIf Return canvas End Method
fltk needed some nasty cludging to get a colormap/visual combo which I think had to be shared by all contexts, but i think you will be fine ignoring that.
XVisualInfo *visual; Colormap colormap; public: Fl_Canvas(int x,int y,int w,int h,const char *title):Fl_Window(x,y,w,h,title) { enabled=1;mode=0;visual=0; } void setenabled(int yesno) { enabled=yesno; } void setmode(int gfxmode) { mode=gfxmode; } void show() { if (window() && window()->shown()==0) return; //parent is hidden so must defer if (shown()) {Fl_Window::show(); return;} // you must do this! // static XVisualInfo *visual; // static Colormap colormap; if (!visual) { // visual=glXChooseVisual(fl_display,fl_screen,glspec2); visual=_chooseXVisual(mode); colormap=XCreateColormap(fl_display,RootWindow(fl_display,fl_screen),visual->visual,AllocNone); } Fl_X::make_xid(this,visual,colormap); }
ps I found hidegadget more troublesome to implement than freegadget