Reputation: 1036
I am a complete newbie when it comes to Linux, I've touched some of it in OS classes in the 3rd semester, but that's about it. My OS interaction is limited to using WinAPI. I'm in the process of writing low-level systems for my game engine, that is context creation, file handling, HIDs, threading, etc. and I would like to be able to achieve the same functionality on Windows as well as on Linux.
When looking for information about the Linux interface system all I can find is recommendations for libraries like Qt. It's a great library, I've used it on Windows, however I'm not as much interested in taking the path of least resistance as I am in the process of learning to work with Linux. It feels daunting since there isn't anything like Windows.h for Linux AFAIK.
Could you guys try pointing me in the right direction? What native (if such exist) libraries does Linux use for the window system (or just a way of creating an OpenGL context, but with Windows functionality like window focus, relative mouse coordinates, window minimalization), input from the keyboard/mouse/etc., file i/o and threading? Doesn't have to be specific, it would just be nice to be able to type something into Google and get proper results.
Upvotes: 1
Views: 328
Reputation: 34581
Graphics display on GNU/Linux systems is typically done with the X Window System, or X11 for short. But unlike Windows, X11 doesn't have a "built-in" set of UI controls like buttons and labels; it's a lower-level API that deals with just opening a window and drawing things into it.
To build a UI, you could use raw X11 and draw everything yourself, but most programs use a toolkit, a library that builds on top of X11 and implements common controls (such as buttons) and the event-handling infrastructure that you use to program with them. GTK and Qt are two of the most common ones these days, but there are others, such as Motif (which is older and doesn't look as nice). Note that the GNOME desktop environment is built using GTK, and KDE is built using Qt.
If you want to use OpenGL in X11, you use GLX to create a GL context and associate it with a window. It's similar in design to the WGL interface used to set up GL contexts in Windows, but different enough that code written for one can't be used for the other. For convenience and portability, applications often use a higher-level library such as GLFW or SFML to handle GL context creation.
There's work being done on a new windowing framework called Wayland, which will (perhaps) eventually replace X11. Higher-level libraries (like GTK and Qt) will be ported to use Wayland as a backend — just like they can use Windows GDI and Apple Quartz as backends — so applications using those higher-level toolkits shouldn't be impacted much by the switch to Wayland.
Upvotes: 6
Reputation: 11582
The OpenGL website is a good resource
http://www.opengl.org/wiki/Getting_Started#Linux
Upvotes: 1