Why Nostr? What is Njump?
2024-06-12 13:02:12

nilostolte on Nostr: GUI CODE REUSE IS JUST AN UTOPIA, BUT WHY!? Reusable code has always been the holy ...

GUI CODE REUSE IS JUST AN UTOPIA, BUT WHY!?

Reusable code has always been the holy grail in programming, but unfortunately, as far as GUIs are concerned, this concept remained highly elusive, mainly because we developed technologies that actually prevent code reusability.


Determining the best language to code completely portable interfaces is currently a challenge. What is clear is that there must be a way to do that directly on hardware using GPUs, or at least the rendering part. Therefore, shader languages seem to be the most appropriate way to attack this problem.

GLSL seems to be the simplest, the most popular, and the most convenient shader language, since it works in practically all platforms and OS, and it's supported by OpenGL which is an open source library and already a standard in graphics for many decennials.

Despite its simplicity, GLSL still is an uncommon way to do things due to GPUs idiosyncrasies. Fortunately, GLSL hides these details but they are still quite obvious since it works quite differently than common programming languages, that are designed to run on CPUs.

In addition, font management is inexistent in GLSL. This means that font management must be done by hand, that is, by displaying glyphs as paths, one by one, using the glyphs advance widths as well as kerning information.

This is obviously too much to ask for.

Therefore, portability as well as high rendering performance come with a price with nowadays technologies. Once one is willing to pay that price, though, a whole new universe unveils, with huge repercussions.

The question that remains is always the same: why this hasn't been done before and why these tools are not widely available? Probably because we gave priority to other technologies that are easier to use and learn, but that might one day disappear or drastically change.

That's probably not only because of the limitations they impose, but also because of the specific niche they have been created for, and that for this reason, are not portable.

Notwithstanding their widespread use, these technologies can be seen rather as hammers, assuming that all GUI problems are just nails.
Author Public Key
npub1gc28qjz53vlyd9y88k65zlfjv6vceu2qzk9w7nde23r27577h4uqmw30zj