Change display mode on Linux

I am trying to understand software graphics using Xlib and OpenGL. I can create windows, etc., but I stuck with changing display modes.

I can see the available video modes with Xrandr functions ( XRRSizes, XRRRates, XRRGetScreenInfo, XRRConfigSizes), check which one is selected ( XRRConfigCurrentConfiguration), and change the resolution ( XRRSetScreenConfig).

I can specify the available bit depths (aka color depths, i.e. bits per pixel) with XListDepths.

I do not know how to change the bit depth for a given screen.

I could not find a suitable function for setting bit depths and screen sizes in Xrandr. It seems like he is completely unaware of bit depths, which is really strange. I also could not find a suitable function in the Xlib documentation.

So my question is:
How to change the solution and bit depth programmatically under Linux?
Are there any functions in the Xlib library or somewhere else?

I know that there are full-blown libraries for graphics, such as SDL, but I do not want to use them as a dependency only to change the display modes, since I'm trying to write a minimal graphics library myself, for educational purposes.

Edit:
, , Xlib X, X . . X. ─ . , : , , , "". , - , , Linux.

+4

Source: https://habr.com/ru/post/1533494/


All Articles