[Rd] GLFW [Was: Wayland Display Support in R Plot]

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Sun Oct 29 23:20:30 CET 2023


Duncan,

at least according to the docs GLFW doesn't really care - it will forward whatever OpenGL is available on the platform. In fact it says:

"By default it also includes the OpenGL header from your development environment. On some platforms this header only supports older versions of OpenGL. The most extreme case is Windows, where it typically only supports OpenGL 1.2."

so, really, OpenGL 1.2 is perfect.

You can request a minimal version, but don't have to, i.e., old versions are ok. I have tested libglfw3 (3.3.8) with OpenGL 1.2 (on macOS) and it worked just fine.

That said, both points were meant for the list in general - those are nice self-contained projects (add libwayland to Cairo and GLFW to rgl) for someone with spare time to contribute...

Cheers,
Simon



> On 30/10/2023, at 9:48 AM, Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> 
> On 29/10/2023 4:20 p.m., Simon Urbanek wrote:
>>> On 30/10/2023, at 8:38 AM, Dirk Eddelbuettel <edd using debian.org> wrote:
>>> 
>>> 
>>> On 30 October 2023 at 07:54, Paul Murrell wrote:
>>> | I am unaware of any Wayland display support.
>>> |
>>> | One useful way forward would be an R package that provides such a device
>>> | (along the lines of 'Cairo', 'tikzDevice', et al)
>>> 
>>> As I understand it, it is a protocol, and not a device.
>>> 
>> Well, X11 is a protocol, not a device, either.
>> Wayland is a lot worse, since it doesn't really do much at all - the clients are fully responsible for drawing (doesn't even support remote connections).
>> Given that Wayland is essentially a "dumb" framebuffer, probably the easiest way would be to take Cairo and add a libwayland back-end. Cairo is already modular so it's relatively straight-forward to add a new back-end to it (I'd probably just copy xlib-backend.c and replace X11 calls with libwayland calls since the low-level design is the same).
>> However, that is limited only to devices, so you would still run R code in the shell (or other GUI that may or may not by Wayland-based). Given that Wayland is so minimal, you'd need some GUI library for anything beyond that - so you may was well just run a Wayland-based browser and be done with it saving you all the bother (oh, right, that's called RStudio ;)).
>> One package that may be worth adding Wayland backend to is rgl so you get OpenGL on Wayland - I'd simply re-write it to use GLFW so it works across all platforms and including Wayland.
> 
> I looked into using GLFW a while ago, but it seemed too hard to do without other really major changes to rgl, so that's not going to happen soon (unless someone else does it).
> 
> I think the issue was that it was hard to get it to work with the ancient OpenGL 1.2 that rgl uses.  I forget whether it was just hard or actually impossible.
> 
> I am slowly working towards having rgl use newer OpenGL versions, but I don't expect this to be done for quite a while.
> 
> Duncan Murdoch
> 
>> Cheers,
>> Simon
>>> Several Linux distributions have long defaulted to it, so we already should
>>> have thousands of users. While 'not X11' it provides a compatibility layer
>>> and should be seamless.
>>> 
>>> I think I needed to fall back to X11 for a particular applications (likely
>>> OBS) so my session tells me (under Settings -> About -> Windowing System) I
>>> am still running X11. I'll check again once I upgrade from Ubuntu 23.04 to
>>> Ubuntu 23.10
>>> 
>>> See https://en.wikipedia.org/wiki/Wayland_(protocol) for more.
>>> 
>>> Dirk
>>> 
>>> -- 
>>> dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
>>> 
>>> ______________________________________________
>>> R-devel using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>> 
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 



More information about the R-devel mailing list