C/C++ Draw graphics on display without Xorg

OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Reaction score: 102
Messages: 659

Thank you Aragats!
Is /usr/include/sys/fbio.h in FreeBSD the unique possibility? (like does the layer vgl or without vgl,
directly using signal, consio, ioctl, fbio.
 

ralphbsz

Daemon

Reaction score: 865
Messages: 1,394

If the goal is education and maths, I suggest the following. Start by getting a good computer graphics textbook; the kind of thing that undergraduate CS majors would read. I don't own one (not a UI person), but a friend used to have a good one in the 1980s.

Then find some programming system that allows you to directly draw points, lines, rectangles, and circles. My first approach would actually be to either do this in postscript (which also teaches a highly useful programming language and programming style, namely postscript and stack-based programming), or in HTML5 with Javascript. In HTML5, just create a canvas and a graphics context, and then use functions such as context.putImageData to put graphics elements into the canvas. That will be much easier to start with, and will teach you how to get graphics built.

If you really insist on using the hardware frame buffer, then the techniques that aragats suggested sound reasonable. Another approach I would suggest: Find some framework (like Kivy or Qt5) which is capable of using the frame buffer under FreeBSD, and read the source code so as to see how they do it. That will give you a starting point for the techniques experienced programmers use; then combine it with reading documentation for the API they use, and combining it with a good textbook.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Reaction score: 102
Messages: 659

wolfram mathematica is widely used today.

@ralphbsz:
Framebuffer is still available.

An user interface can be of course programmed in Java, Qt, GTK,..., to be used with a mouse / pointer.
A graphical user interface and the computer mouse have become most often used with a personal computer.
It is however important to keep things like it should, not to use QT for framebuffer, if it is not necessary.

There is a quote attributed to Einstein that may have arisen as a paraphrase of the above quote, commonly given as “Everything should be made as simple as possible, but no simpler,” "Everything should be made as simple as possible, but not simpler", or “Make things as simple as possible, but not simpler.”

fb looks stable. It looks sufficiently available for next coming years.
It runs without need of Xorg installation or additional graphical env, like coming wayland (or other).
Framebuffer does not need numerous layers of layers of libraries.
It does not depends on drivers for GL.
It does not require or need regular code updates/maintainance.
It has a clean usage of the memory and resource, and it allows to protect our environment.
It allows to do not use Wayland, SDL, QT, GTK,...

For some specific areas of applications, a low specs-computer like a PI for educative purpose can display highly complex 2D plots/outputs of simulations. For simple graphical applications and specific requirements, it can be a convenient, versatile option, due to previously mentioned advantages.
Furthermore, it is cheap, compilable, and widely available.

But, in term of longevity, much better is Microsoft MSDOS or FreeDOS. But it needs the environment to run it. MSDOS would be more reliable, because it runs on any kind of platforms and it will be stable over years.

Last but not least, low-power consumption devices and Energy Efficient Computing are important for education, for students, ... academic. The earlier getting used to it, the better. It protects our planet.
 
Top