r/ProgrammingLanguages • • Oct 29 '26

How programming languages approach graphics

Many general-purpose languages delegate graphics to third-party libraries (like SDL, Raylib, or OpenGL). Seed7 integrates portable 2-D graphics right into its standard library. This IMHO improves portability. I also thought about introducing operators / statements to do graphics, but until now I don't use operators or statements to do graphics.

29 Upvotes

81 comments sorted by

View all comments

6

u/Dykam Oct 29 '26

Does it improve portability? It puts the onus of portability on the language maintainers themselves. It can also be limiting. Graphics API's move moderately fast (compared to languages), at least in the high performance segment. Separate libraries allow developers to opt in to the generation they want to use.

I think it's nice to have, but it may feel like a bit much.

2

u/ThomasMertes Oct 29 '26

Does it improve portability?

Yes, if you use 2-D graphics.

If you write a graphic program with X11, GDI, GL or Vulkan you probably need at least 100 lines of code to set up the graphic library, handle events, define callback functions, etc. Did you know that REDRAW / EXPOSE events exist, which tell the program: Some part of your window has been erased. In case of these events the program needs to redraw the erased parts. Imagine if that happens to data in your program: "Some of your data is now garbage, you need to restore it now." Graphic libraries think that this is normal.

The Seed7 graphics library does all that background work for you. So the Seed7 graphics library is not only portable, but it removes some burden from the shoulders as well.

Graphics API's move moderately fast

For this reason Seed7 supports 2-D graphics, an area which has not progressed so fast. This way Seed7 is well suited to write retro games (these games run in the browser - just click on them).

7

u/tsanderdev Oct 29 '26

For GL and especially Vulkan 100 lines is a massive understatement lol. There are projects like webgpu and sdl gpu that reasonably abstract 3d graphics though, but of course it's a lowest common denominator.