dmurdoch/rgl

Update to use a modern OpenGL version, e.g. 3.2

dmurdoch opened this issue · 2 comments

This would make the code more similar between C++ and the WebGL code, allowing shaders in R, etc.

It looks as though the glad and GLFW libraries would make this reasonably straightforward.

It turns out not to be so easy. Those libs assume that Macs are using the native Apple OpenGL. It looks nice, and doesn't seem to require Xquartz, but it has been deprecated by Apple and some of the code in rgl (e.g. text) doesn't work with it. Maybe that could be fixed, but after a while trying, I'm giving up.

glad with GLX (without GLFW) might work, but there's still the assumption that Macs are using the Apple libs, not what comes in Xquartz. I couldn't figure out the right patch.

I'll try again with my own loader. According to what I've read, Macs should support OpenGL 2.1, and just about everyone else should too. I think that's all I'd need for shaders. Macs will only support 3.2 using the core profile, i.e. legacy code (of which there's a lot in rgl) won't be supported. And that may not even still be true, due to their deprecation plans.

PR #319 allows newer versions to be used if present. Currently almost nothing makes use of the new features, but features up to 3.0 are available if supported on the system. Increasing beyond that would just require generating a new glad loader.