Linux Graphics – Exploring Low-Level Techniques

graphicslinux

For educational purposes, I'd like to write an application on a Linux environment that can process keyboard events and draw graphics without huge dependencies like X or SDL. I presume that this must be possible, because X and SDL are just programs themselves, so they must rely on other methods inherent to the environment. Is this understanding correct?

If so, where might I learn to write such a program? My limited experience tells me that it would involve making calls to the kernel, and/or writing to special files; however, I haven't been able to find any tutorials on the matter (I am not even sure what to Google).

Also, in case it is relevant, I am running Debian Squeeze on Virtualbox. I have used a netinst cd without networking, so there isn't much installed on it currently. I will install gcc, but I am hoping I can get by with nothing more.

Best Answer

X (or the X Window System) is practically the most low-level graphics API a Linux application will likely use on a modern Linux Desktop. Most applications won't even bother going that deep and will instead use a GUI toolkit implementation like GTK or Qt.

Below that there's only the hardware drivers and probably some X-internal APIs for the drivers. But those are not meant or designed to be used by normal userspace applications.

You could use the kernel framebuffer device (fbdev), but I don't know how well that supports modern graphics API.

Edit: Wayland is an alternative to X that has only recently found some mainstream adoption. It is now possible to run a Linux-Desktop purely on Wayland with no X-Windows system running at all. Wayland itself depends on an EGL driver underneath (an API strongly related to OpenGL).

Related Topic