Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
487 views
in Technique[技术] by (71.8m points)

linux - What is the difference between OpenGL and XRender in KDE Desktop Effects?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

OpenGL and XRender are both drawing APIs that allow for applications of certain geometrical transformations while doing so.

OpenGL is targeted at drawing operations to be executed by a dedicated graphics processing unit (GPU) and provides many features that make generating a 3D-looking image very easy (depth buffer, depth testing, 4×4 homogenous transformation matrices). But you can do 2D looking graphics as well with OpenGL.

XRender is an extension to the X11, to support methods of rendering (antialiasing, alpha blending) that are not possible to do with the core X11 drawing functions. The XRender-API is optimized for 2D looking graphics, though (no depth buffer/test, 3×3 transformation matrices).

Note that XRender is not perfectly orthogonal to OpenGL. Epecially if you need antialiasing in OpenGL you have to use a few functions from XRender to enable it.

What's the use case of each option?

The option of XRender is there to support systems for which there is no proper OpenGL support (lack of stable drivers), but acceptable support for XRender operations. Also XRender is a bit easier to setup (from a programmers point of view) than OpenGL.

In general OpenGL is more flexible than XRender from a programmers perspective. If you're asking which of each you should choose: Start with OpenGL and if everything works acceptable stick with it. The XRender option is a fallback if OpenGL doesn't work properly (however since nowadays in the drivers XRender shares a large part with OpenGL, or is actually implemented using OpenGL it makes no practical difference any more).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...