Not so minimal, but if you need GPU rendering I wrote this: https://github.com/jacereda/glcv
Minimal Cross-Platform Graphics
41–50 of 67 posts
Re: Minimal Cross-Platform Graphics
#42https://github.com/erkkah/tigr
Brief discussion:
Re: Minimal Cross-Platform Graphics
#43Earlier quoted context omitted.
2d graphics are rendered on the GPU nowadays, and rightly so. Even SDL uses the GPU wherever it can, by default.
That's a silly statement. If you want to place single pixels, a GPU won't help in any way. The most efficient way would be to write pixels with the CPU into a mapped GPU texture, and then render this texture as fullscreen quad. That's hardly more efficient than going through the system's windowing system. For applications like emulators, or making vintage games (like Doom) run on modern platforms, that approach makes…
Re: Minimal Cross-Platform Graphics
#44This is extremely useful, and the page is beautifully written. Some people write absurd electron behemoths, and then there's this jewel of elegance. Could this be compiled as an αpε? Such a thing would make many heads explode.
Re: Minimal Cross-Platform Graphics
#45This is extremely useful, and the page is beautifully written. Some people write absurd electron behemoths, and then there's this jewel of elegance. Could this be compiled as an αpε? Such a thing would make many heads explode.
Alpha Rho Epsilon? Alpha Pee Epsilon? Google isn't helping me here...
One of many HN discussions about the topic here:
Re: Minimal Cross-Platform Graphics
#46This is extremely useful, and the page is beautifully written. Some people write absurd electron behemoths, and then there's this jewel of elegance. Could this be compiled as an αpε? Such a thing would make many heads explode.
Alpha Rho Epsilon? Alpha Pee Epsilon? Google isn't helping me here...
Re: Minimal Cross-Platform Graphics
#47Re: Minimal Cross-Platform Graphics
#48This is extremely useful, and the page is beautifully written. Some people write absurd electron behemoths, and then there's this jewel of elegance. Could this be compiled as an αpε? Such a thing would make many heads explode.
I think the Xlib dependency would prevent compilation as an αpε. I put some effort into doing X11 from scratch (without Xlib or Xcb) to make this possible. Or at least, my aim was to be able to build with musl libc and generate a single executable that would run on many different Linuxes. https://github.com/abainbridge/deadfrog-lib/blob/master/src/... . It is janky though.
Re: Minimal Cross-Platform Graphics
#49Wonderful. I really wanted something like this to do Graphic the "hard way", also the most fun way... I was trying to use Tcl-TK for that but this seems a lot lower level, perfect for what I wanted to do which is to write a small GUI toolkit for tiny apps.
Writing pixels into an RGBA framebuffer in main memory is fun, but it's also the easy and slow way to do graphics. The hard way these days is to figure out how to use a modern GPU to do the rendering you need. It's almost always several orders of magnitude faster.
the benefit of the gpu is no longer (since maybe late last millennium) that you don't have the memory bandwidth to your framebuffer; it's that you can do a lot of computation per pixel
typically the gpu advantage is only about an order of magnitude tho
Re: Minimal Cross-Platform Graphics
#50Very cool! This example I think needs editing: memset(f->buf, rgb, f->width*f->height*sizeoof(uint32_t)); it's described as a way to "fill the complete framebuffer with a solid colour", but 'rgb' is shown in the previous snipped to be 'uint32_t'. That is not how 'memset()' [1] works, it will only use the least significant 8 bits of the 'int'-typed value argument. So it would use whatever blue bits where in 'rgb', onl…
Fine, but at least fix this bug: .. (sizeof *f->buf) .. Because otherwise thats one stray space char away from a bad day ..