How to use OpenGL without a window manager in Linux?

眉间皱痕 提交于 2019-12-22 09:24:41

问题


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?


回答1:


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 :-)




回答2:


kmscube DRM example

It is possible, the most popular demo available is https://github.com/robclark/kmscube which uses OpenGL and EGL.

Unfortunately, the Ubuntu 18.04 package with NVIDIA proprietary drivers it does not work for me:

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.




回答3:


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.



来源:https://stackoverflow.com/questions/3804065/how-to-use-opengl-without-a-window-manager-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!