OpenWL/DL - two foundation libraries for building a cross-platform GUI with non-C++ languages
DanielG
simpletangent at gmail.com
Fri Apr 12 09:47:25 UTC 2019
On Friday, 12 April 2019 at 08:03:01 UTC, Dennis wrote:
> I'm currently using glfw for that, how does OpenWL compare?
Good question. I've not spent much time with OpenGL-y things, but
from what little I know:
- OpenWL doesn't use or provide OpenGL contexts. I'm sure it will
be added eventually, but at this time it's meant to provide a
canvas for platform-native drawing - such as Quartz2D (still
CPU-rendered AFAIK), Direct2D (GPU accelerated), and Cairo (CPU).
- With OpenDL, you ideally don't have to write any of your own
drawing-primitives code. Need beziers, gradients, fancy masking
with text outlines? If Quartz2D/CoreText supports it, then it's
either already present, or I can add it quickly.
- OpenWL/DL aren't designed for games or insane frame rates. I
*do* think a smooth, 60fps experience is worth shooting for, but
because it's CPU-bound with Quartz2D on Mac, and Cairo on Linux,
that will depend entirely on the user's resolution / CPU. (But
Direct2D is GPU-accelerated and already crazy fast)
When I get a chance, I do plan on looking into how difficult it
would be to implement a Core Animation compatible API, to allow
for smooth scrolling / scaling / etc of large pre-rendered areas
via GPU. (MacOS uses CoreAnim to speed up things like scrolling,
which would otherwise be choppy when CPU-rendered on a 5K
display).
- OpenWL is event-based, not polling-based. In the OpenGL demos
I've seen in the past, the render loop goes as fast as it can.
Whereas OpenWL waits for the platform windowing system to notify
it of whatever events have occurred. If nothing is happening,
there is no drawing/activity.
Now, an alternative to OpenWL/DL might be something GLFW+NanoVG.
And I certainly looked into those kinds of options before going
this route. But ultimately I decided against it, because I wanted
to build on top of what Apple/Microsoft/GNOME are actively
working on. I figured, let the big companies focus on making what
they feel are the best drawing APIs for their respective
platforms, and I'll just ride on their coattails (and
optimizations) ...
At this time, a purely OpenGL drawing library is still a little
too DIY for me. Now maybe if the Slug text rendering library were
open source, and a number of people were actively trying to
integrate it with NanoVG, then I could be persuaded...
Another benefit of not using OpenGL, is that I can eventually
support esoteric platforms with no modern OpenGL support, but for
which Cairo/Pango can be compiled. Things like: MorphOS/Amiga,
QNX Photon, OS/2, Mac OS9/Carbon, etc. Pretty much anything with
a conventional single-threaded GUI, really.
More information about the Digitalmars-d-announce
mailing list