FLTK without X11 on Linux

50 views
Skip to first unread message

ed.vi...@gmail.com

unread,
Jan 3, 2022, 9:18:39 AM1/3/22
to fltk.general
Hello

I have developed an FLTK visualization application which uses GL and produces PNGs. I would also like to use it on systems remotely without having to connect to an X11 server. I can use OSmesa to create the OpenGL context but FLTK uses some X11 calls. Would it be possible to compile FLTK without having to link any X11 libraries? I need a window in which to run the OpenGL commands. 

Cheers
Ed
 

Ian MacArthur

unread,
Jan 3, 2022, 5:45:58 PM1/3/22
to Fltk General
On 3 Jan 2022, at 14:18, <ed.vigmond wrote:
>
> Hello
>
> I have developed an FLTK visualization application which uses GL and produces PNGs. I would also like to use it on systems remotely without having to connect to an X11 server. I can use OSmesa to create the OpenGL context but FLTK uses some X11 calls. Would it be possible to compile FLTK without having to link any X11 libraries? I need a window in which to run the OpenGL commands.


There’s generally no simple way to use stock fltk on a host without some form of window management system - under *nix that is some WM hosted on X11 at present (though Win32 and macOS hosts will usually use the host native WM systems rather than X11, of course, and future *nix systems may well use Wayland as the renderer along with some WM service...)

In the past, I’ve run fltk (and Fl_Gl_Window) on a vxWorks host with no WM running, but even there I was using X11 to get the basic windows up, and that was a heavily modified fltk build anyway...

With later fltk versions, and certainly with the 1.4 branch, the lowest-level driver support has been split out, to make it “easier” (at least in principle) to implement your own back-end, and hence to support the sort of thing you are proposing; but even there I imagine it’d be a fair chunk of work to do, and I don’t think anyone has ever tried quite what I think you are asking...

Of course, it’s entirely feasible I haven’t understood the question!


Daniel G.

unread,
Jan 3, 2022, 6:23:15 PM1/3/22
to fltk.general
If you want to run your app headless you can maybe use xvfb.

Greg Ercolano

unread,
Jan 3, 2022, 9:09:48 PM1/3/22
to fltkg...@googlegroups.com

On 1/3/22 6:18 AM, ed.vi...@gmail.com wrote:

Hello

I have developed an FLTK visualization application which uses GL and produces PNGs. I would also like to use it on systems remotely without having to connect to an X11 server. I can use OSmesa to create the OpenGL context but FLTK uses some X11 calls. Would it be possible to compile FLTK without having to link any X11 libraries? I need a window in which to run the OpenGL commands. 

    FLTK is pretty tied to the window manager's event systems (mouse, keyboard..).

    If your needs are purely openGL and PNG generation, you probably
    should decouple  your program from all window manager oriented graphics
    (e.g. FLTK, GLUT, etc) by splitting it into a back end (that doesn't require FLTK)
    and a front end (that does use FLTK) so you can compile your program in two
    different modes, e.g. one for headless rendering, the other for interactivity
    with the user using widgets/events.


ed.vi...@gmail.com

unread,
Jan 6, 2022, 8:41:54 AM1/6/22
to fltk.general
I was just wondering because I figured with all the WMs supported, it might not be too hard to add one which was a dummy and basically ignored events. Anyways, the main issue was that I was on a cluster without a working Xvfb which has since been fixed.

15+ years and 1000's of lines into developing my program, I probably would have done things differently if I had known.

Ian MacArthur

unread,
Jan 6, 2022, 8:57:30 AM1/6/22
to Fltk General
On 6 Jan 2022, at 13:41, ed.vigmond wrote:
>
> I was just wondering because I figured with all the WMs supported, it might not be too hard to add one which was a dummy and basically ignored events.

The crux here is that “all” WM’s are “the same” in that they handle Window decoration and placement, and handle the events to/from the app. This is literally true under X11 where the Wm’s are more or less compliant with the ICCCM rules, and the Win32 and macOS systems are “analogous” to that, at least sufficiently that we can pretty much map the same logic and functionality in each case.

I suppose you could write a “dummy” WM-like stub that pretended to be implementing the ICCCM but did not actually communicate with any underlying X-server or such, but... Hmm, well, I’m not sure, actually... might be trickier than I initially thought... something like nano-X might be easier?
FWIW, the last time I tried nano-X (which was a while ago) it did work OK with fltk, though it took a little bit of poking - ISTR that I wrote up a HowTo at the time, so it’ll be on the fltk site somewhere, but... probably not that useful to you either, TBH.


> Anyways, the main issue was that I was on a cluster without a working Xvfb which has since been fixed.

OK, good.

>
> 15+ years and 1000's of lines into developing my program, I probably would have done things differently if I had known.


Yeah. Hindsight...


Reply all
Reply to author
Forward
0 new messages