开发者

How to use OpenGL without a window manager in Linux?

I've just finished the LFS book and my Linux system is working right now. I want to use OpenGL to display graphics on the screen, while the only installed package 开发者_开发技巧right now are those described on http://www.linuxfromscratch.org/lfs/view/stable/chapter03/packages.html.

I don't want to install something like Gnome, KDE or X.org. Instead, I want to use OpenGL directly from my software. Is this possible, and how can I do this? Or is it just as easy (I don't think so :'p) as writing an OpenGL application which runs full screen?


You don't have to install Gnome or KDE. These are used to managed windows, and you can launch graphical applications without having a window manager.

Therefore, you'll have to install a X server. The X server is responsible of drawing things on your screen. Without X server, you can't launch graphical applications.

Once X has been installed, launch it, export your DISPLAY environment variable, and the rest is like writing an OpenGL application which runs full screen :-)


You can use Pygame as well to create custom launch UI. Also try looking at Wayland compositor as it has replaced XServer in verisons like Fedora and Ubuntu.


kmscube DRM example

https://github.com/robclark/kmscube

This is possibly the most popular demo available, it uses OpenGL and EGL.

Unfortunately, the Ubuntu 18.04 package with NVIDIA proprietary drivers it does not work for me after going into Ctrl + Alt + F3:

drmModeGetResources failed: Invalid argument
failed to initialize legacy DRM

bug report: https://github.com/robclark/kmscube/issues/12

But I did get it working on emulator.

It takes over the entire display, and shows a colorful spinning cube.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜