iOS:是在OpenGL之上实现的Core Graphics吗? [英] iOS: is Core Graphics implemented on top of OpenGL?

查看:84
本文介绍了iOS:是在OpenGL之上实现的Core Graphics吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了一个图表,显示了在OpenGL上面实现的Core Graphics,另一个图表显示了OpenGL。我认为Apple会很聪明地让每个人都可以平等地访问图形硬件但是我再也不知道他们正在使用的图形芯片......也许它一直都是3D?

I have found one diagram that shows Core Graphics implemented above OpenGL, and another that puts it alongside OpenGL. I would think that Apple would be smart to give each equal access to the graphics hardware but then again, I don't know much about the graphics chip they are using... maybe it is 3D all the way?

这里有人知道具体细节吗?

Does anybody here know the specifics?

推荐答案

是的,在iOS核心图形上(石英) )似乎是在OpenGL ES之上进行分层,用于绘制目标屏幕,但不是以我们有权访问的显式方式。

Yes, on iOS Core Graphics (Quartz) appears to be layered on top of OpenGL ES for drawing that targets the screen, although not in an explicit way that we have access to.

Core Graphics采用向量元素(线条,弧线等)和一些光栅(图像)并处理它们以显示到屏幕或其他形式的输出(PDF文件,打印等)。如果目标是iOS上的屏幕,那些矢量元素将直接或通过UIView的后备层托管在CALayer中。

Core Graphics takes vector elements (lines, arcs, etc.) and some raster ones (images) and processes them for display to the screen or for other forms of output (PDF files, printing, etc.). If the target is the screen on iOS, those vector elements will be hosted in a CALayer, either directly or through the backing layer of a UIView.

这些Core Animation图层实际上是围绕GPU上矩形纹理的包装器,这就是Core Animation可以提供甚至原始图层的平滑平移,缩放和旋转的方式iPhone硬件。我现在找不到它的参考,但至少有一个WWDC演示文稿指出Core Animation使用OpenGL ES与GPU通信以执行此硬件加速。在新的双GPU MacBook Pro上可以观察到类似的东西,当使用Core Animation与应用程序交互时,更强大的GPU会起作用。

These Core Animation layers are effectively wrappers around rectangular textures on the GPU, which is how Core Animation can provide the smooth translation, scaling, and rotation of layers on even the original iPhone hardware. I can't find a reference for it right now, but at least one WWDC presentation states that OpenGL ES is used by Core Animation to communicate with the GPU to perform this hardware acceleration. Something similar can be observed on the new dual-GPU MacBook Pros, where the more powerful GPU kicks in when interacting with an application using Core Animation.

因为Core Graphics光栅化了当绘制到屏幕时,矢量和栅格元素进入CALayer,并且CALayer有效地包裹OpenGL ES纹理,我将OpenGL ES放在iOS上的Core Graphics下面,但仅适用于Core Graphics渲染到屏幕的情况。在您看到的层次结构中并排放置的原因可能是由于三个因素:在Mac上,并非所有视图都是图层支持的,因此它们可能不会以相同的方式进行硬件加速;我们无法真正与标准UI元素的OpenGL ES支持进行交互,因此从开发人员的角度来看,它们是截然不同的概念;和Core Graphics可用于渲染到屏幕外的内容,如PDF文件或图像。

Because Core Graphics rasterizes the vector and raster elements into a CALayer when drawing to the screen, and a CALayer effectively wraps around an OpenGL ES texture, I would place OpenGL ES below Core Graphics on iOS, but only for the case where Core Graphics is rendering to the screen. The reason for the side-by-side placement in the hierarchy you saw may be due to three factors: on the Mac, not all views are layer-backed, so they may not be hardware accelerated in the same way; we can't really interact with the OpenGL ES backing of standard UI elements, so from a developer's point of view they are distinct concepts; and Core Graphics can be used to render to offscreen contexts, like PDF files or images.

这篇关于iOS:是在OpenGL之上实现的Core Graphics吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆