GLXCHOOSEVISUAL(3gl)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

✨ GLXCHOOSEVISUAL(3G) ✨

okay bestie, buckle up, this is the glXChooseVisual page from the GLX manual (section 3G, the graphics-girlies section πŸ’…). it's giving "help me pick a visual" and honestly? it's iconic.


πŸŽ€ NAME πŸŽ€

glXChooseVisual β€” return a visual that matches specified attributes


🌸 C SPECIFICATION 🌸

XVisualInfo* glXChooseVisual( Display *dpy,
                              int screen,
                              int *attribList )

delim $$


πŸ¦‹ PARAMETERS πŸ¦‹

  • dpy β€” the connection to the X server. your lil phone line to the display, fr fr.
  • screen β€” the screen number.
  • attribList β€” a list of boolean attributes and integer attribute/value pairs. and listen, the last attribute must be None. no cap.

πŸ’– DESCRIPTION πŸ’–

glXChooseVisual returns a pointer to an XVisualInfo structure describing the visual that best meets a minimum specification. slay.

the boolean GLX attributes of the visual that gets returned will match the specified values, and the integer GLX attributes will meet or exceed the specified minimum values. and here's the cute part: if all other attributes are equivalent, then TrueColor and PseudoColor visuals have priority over DirectColor and StaticColor visuals, respectively. it's giving ranked-choice voting πŸ—³οΈβœ¨

if no conforming visual exists, NULL is returned. to free the data returned by this function, use XFree. (yes bestie, you gotta clean up after yourself, that's the vibe.)

all boolean GLX attributes default to False except GLX_USE_GL, which defaults to True. all integer GLX attributes default to zero. default specifications are superseded by attributes included in attribList. boolean attributes included in attribList are understood to be True. integer attributes and enumerated type attributes are followed immediately by the corresponding desired or minimum value. and the list must be terminated with None. periodt.

the interpretations of the various GLX visual attributes are as follows, and yes we're doing all of them, every single one, no skips:

  • GLX_USE_GL β€” ignored. only visuals that can be rendered with GLX are considered. (she's just there for the plot, but the plot still requires her.)
  • GLX_BUFFER_SIZE β€” must be followed by a nonnegative integer that indicates the desired color index buffer size. the smallest index buffer of at least the specified size is preferred. ignored if GLX_RGBA is asserted.
  • GLX_LEVEL β€” must be followed by an integer buffer-level specification. this specification is honored exactly. buffer level zero corresponds to the main frame buffer of the display. buffer level one is the first overlay frame buffer, level two the second overlay frame buffer, and so on. negative buffer levels correspond to underlay frame buffers. (levels, layers, lore πŸ’…)
  • GLX_RGBA β€” if present, only TrueColor and DirectColor visuals are considered. otherwise, only PseudoColor and StaticColor visuals are considered.
  • GLX_DOUBLEBUFFER β€” if present, only double-buffered visuals are considered. otherwise, only single-buffered visuals are considered.
  • GLX_STEREO β€” if present, only stereo visuals are considered. otherwise, only monoscopic visuals are considered.
  • GLX_AUX_BUFFERS β€” must be followed by a nonnegative integer that indicates the desired number of auxiliary buffers. visuals with the smallest number of auxiliary buffers that meets or exceeds the specified number are preferred.
  • GLX_RED_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, the smallest available red buffer is preferred. otherwise, the largest available red buffer of at least the minimum size is preferred.
  • GLX_GREEN_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, the smallest available green buffer is preferred. otherwise, the largest available green buffer of at least the minimum size is preferred.
  • GLX_BLUE_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, the smallest available blue buffer is preferred. otherwise, the largest available blue buffer of at least the minimum size is preferred.
  • GLX_ALPHA_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, the smallest available alpha buffer is preferred. otherwise, the largest available alpha buffer of at least the minimum size is preferred.
  • GLX_DEPTH_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, visuals with no depth buffer are preferred. otherwise, the largest available depth buffer of at least the minimum size is preferred.
  • GLX_STENCIL_SIZE β€” must be followed by a nonnegative integer that indicates the desired number of stencil bitplanes. the smallest stencil buffer of at least the specified size is preferred. if the desired value is zero, visuals with no stencil buffer are preferred.
  • GLX_ACCUM_RED_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, visuals with no red accumulation buffer are preferred. otherwise, the largest possible red accumulation buffer of at least the minimum size is preferred.
  • GLX_ACCUM_GREEN_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, visuals with no green accumulation buffer are preferred. otherwise, the largest possible green accumulation buffer of at least the minimum size is preferred.
  • GLX_ACCUM_BLUE_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, visuals with no blue accumulation buffer are preferred. otherwise, the largest possible blue accumulation buffer of at least the minimum size is preferred.
  • GLX_ACCUM_ALPHA_SIZE β€” must be followed by a nonnegative minimum size specification. if this value is zero, visuals with no alpha accumulation buffer are preferred. otherwise, the largest possible alpha accumulation buffer of at least the minimum size is preferred.

🌈 EXAMPLES 🌈

attribList =
            {GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4,
            GLX_BLUE_SIZE, 4, None};

so what's this one doing? it specifies a single-buffered RGB visual in the normal frame buffer β€” not an overlay or underlay buffer. the returned visual supports at least four bits each of red, green, and blue, and possibly no bits of alpha. it does not support color index mode, double-buffering, or stereo display. and it may or may not have one or more auxiliary color buffers, a depth buffer, a stencil buffer, or an accumulation buffer. (she's mysterious like that πŸ™ˆ)


πŸ’œ NOTES πŸ’œ

XVisualInfo is defined in Xutil.h. it's a structure that includes visual, visualID, screen, and depth elements.

glXChooseVisual is implemented as a client-side utility using only XGetVisualInfo and glXGetConfig. calls to these two routines can be used to implement selection algorithms other than the generic one implemented by glXChooseVisual. (iykyk, you can build your own.)

GLX implementers are strongly discouraged, but not proscribed, from changing the selection algorithm used by glXChooseVisual. therefore, selections may change from release to release of the client-side library. so don't come crying to me when your visual switches up on you bestie, it's literally documented 😭

there is no direct filter for picking only visuals that support GLXPixmaps. GLXPixmaps are supported for visuals whose GLX_BUFFER_SIZE is one of the pixmap depths supported by the X server.


πŸ’€ ERRORS πŸ’€

NULL is returned if an undefined GLX attribute is encountered in attribList. (rip, undefined behavior jumpscare, but it's just a NULL, breathe.)


⭐ SEE ALSO ⭐

  • glXCreateContext
  • glXGetConfig

and that's the whole page bestie, no crumbs left 🫢 this was the GLXCHOOSEVISUAL manual page β€” footer and all, that's the page name GLXCHOOSEVISUAL() sitting down there, part of the GLX docs, and honestly? she ate. go pick a visual, you got this πŸ‘‘πŸ’–

πŸ“¦ where this page comes from