Does OpenGL use Xlib to draw windows and render things, or is it the other way around?

前端 未结 3 718
谎友^
谎友^ 2021-02-01 10:26

I want to render fonts and lines on a window using either OpenGL or Xlib, but I\'d like to know which one is \"more fundamental\".

Usin

3条回答
  •  一生所求
    2021-02-01 10:45

    Xlib drawing commands send obsolete requests over a network socket. The original drawing commands are obsolete, e.g. current toolkits don't use the text-specific X requests. It looks like the (anti-aliased) XRender extension is still used. The X server can implement requests using whatever method it likes. See: glamor, XRender implemented using opengl.

    OpenGL is equally an API, not a specific implementation.

    • It is implemented on platforms which do not rely on X11, including Windows. (In this case X11 is available as third-party software).
    • It is also implemented on Wayland, the successor to X11 on Linux, which otherwise has no equivalent to XRender.
    • When opengl hardware acceleration is not available, opengl might render in software.

    There is no answer to this question, and you can easily construct situations which work either way around, or where only one of the two is available, or where both implement hardware acceleration and don't use the other, etc.

    OpenGL provides access to a greater range of GPU capabilities, e.g. shader programming. In that sense, it allows more full control of the hardware.

    aside: opengl has a text drawing api?? i am confused.

    Perhaps the author of this question intended to include a linux tag.

    Quickly googling, the most recent article I found here. I expect there's better somewhere. There's also a Wikipedia page on GLX

提交回复
热议问题