If nothing else, transparency could be implemented at a higher level. At the expense of having to use a second buffer of course. Also seems a bit of a drawback, what with the need for sudo privileges to run such an application.
I don't require sudo privileges. Normally I start my project with a base template that includes all header files (commented out), a main routine (for checking argument and privileges), and a starting function (in case I just want to dump some code and quickly run it.
Anyway, I noticed when running my program, that the following was still commented out, meaning I don't need elevated privileges.
Edit: I don't know if adding my username to the group 'video' made a difference or not though.Code:/* // Check that user is root or that sudo is used. if(geteuid() != 0) { fprintf(stderr, "%s: must be run as root or with 'sudo'\n", program_name); exit(EXIT_FAILURE); } */
Last edited by Yonut; 04-14-2023 at 01:10 PM. Reason: Afterthought
Well sure if you're running things in "developer mode" (so to speak), why not? I was thinking more in terms of whether or not framebuffers might be a good route for "general application development".
And yes the "video" group is naturally granted special privileges not available to the average user.
I did notice that the program you've posted doesn't seem to write anything to the screen. Perchance do you have a more complete working example?
This is a simple example of basic drawing, it should work from the console. When you use xwindows, it won't show the framebuffer I use in my program. Dunno why. But if you can exit xwindows or wayland and go back to the console (tty), it should display a red line. If you're on a tty and it isn't visible, maybe increase the following:
Basically this all started from wanting to recreate the digital front cover of the "IT Crowd" dvd. I've got Moss all mapped out, but wanted to add the gradient background. Here is what I'm talking about:Code:#define SIZE_OF_MARK 4
Ah right, sudo chvt 1 to switch to pure-tty. Program displays just fine. Then sudo chvt 7 to get back to Xorg system. (CTL-ALT-F1/CTL-ALT-F7 also works).
Again, just do the transparency masking "by hand". Long ago I put together a simple graphics library that did just that, drawing basic shapes with anti-aliasing, alpha channel, etc, all done directly on a chunk of memory. Pretty straight-forward stuff actually.