D
D
damq1n2019-09-01 20:14:41
linux
damq1n, 2019-09-01 20:14:41

How to run an application with OpenGL from command line without running x server?

Hello!
There is one project where I want to try using raspberry.
raspberry will display data from some physical sensors.
That is, I want to draw some graphics on the display based on sensor data.
At once I will make a reservation that never worked in linux.
The command line and linux itself are still wild for me, but this does not stop me, I study everything that is necessary for the implementation of my project. :)
As I see it for myself, for speed and the fastest launch (which is critical for me), use the bare operating system as much as possible, so that at the time of launching rassbery, the application I wrote is launched. Accordingly, loading the shell is initially long and not desirable.
You need to load the command line. And from it to launch my application with graphics.
How I tried.
While there is no confusion on hand, I installed ubntu on the virtual machine.
Wrote a simple program that draws a triangle using OpenGL(MESA).
Compiled, launched in a shell, everything is ok. Drawn.
I disabled the graphical shell and the program cannot start, swearing "failed to open display 0.0".
But in principle it is understandable, the x server is stopped.
glxinfo also swears at display 0.0
That is, xserver still needs to be started, but how to start xserver so that the shell does not start loading, as it happens with me?
Although maybe I initially chose the wrong path for implementation?
Advise how to finish my way or advise another way that will work.
If I'm talking nonsense, then I'm sorry))
You need to get something similar on the screen, but of course I want to use more advanced graphics
5d6c034b26cb0323413765.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Moseychuk, 2019-09-01
@damq1n

Bombit
2 ответа и оба абсолютно бесполезные.
Один говорит не нужна тебе графика, используй голую консоль. Второй пытается убедить, что ты ничего не понимаешь иди читай доки. Рональду давно пора дать ачивку за самые бесполезные и некомпетентные ответы в мире.

You can start x by simply executing the 'X' command, and then in another console, export the display variable and run your program.
But the most convenient option is to use startx when running your program instead of DM.
https://wiki.archlinux.org/index.php/Xinitrc_(%D0%...

R
Ronald McDonald, 2019-09-01
@Zoominger

Well, output using the CLI.
If you need at least some graphics, use ncurses.

P
pfg21, 2019-09-01
@pfg21

everything is quite natural.
your program is designed to display an object in a graphical interface.
if there is no graphical interface, then it does not know where to display the object, and it justifiably crashes with the output error that you see.
until you explain what you mean by "I want to draw some graphics on the display" with the graphical shell turned off, which actually draws the graphics, no further progress will be made.
to learn how to work with the x-server, you need to read what STE is and how it works. direct question - what did you read??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question