OpenGL & Metal

了解OpenGL ES

2020-07-27  本文已影响0人  黑眼豆豆_

OpenGL ES(OpenGL for Embedded Systems)是以手持和嵌入式为目标的高级3D图形应用程序编程接口(API),它支持的平台包括iOS、Android、BlackBerry等等。它是OpenGL的子集,它消除了冗余功能。

OpenGL ES provides a C-based interface for hardware-accelerated 2D and 3D graphics rendering. The OpenGL ES framework (OpenGLES.framework) in iOS provides implementations of versions 1.1, 2.0, and 3.0 of the OpenGL ES specification.
 This collection of documents describes the platform-specific APIs for OpenGL ES on iOS devices, also known as EAGL. EAGL provides graphics contexts that encapsulate all OpenGL ES state and the ability to configure a Core Animation layer to be the destination for OpenGL ES drawing commands. EAGL also allows OpenGL ES objects, such as textures, renderbuffers, and framebuffers, to be shared between two or more graphics contexts.

图形管线

图形管线.png

顶点着色器

含义

顶点着⾊器程序 —— 描述顶点上执⾏操作的顶点着⾊器程序源代码/可执⾏⽂件

输入

顶点着色器.png

上图就是顶点着色的工作流程,我们可以通过3种方式将值传给顶点着色器.

输出

内建变量,即OpenGL ES已经做好了定义,直接使用,不需要重新定义。

业务

图元装配

图元转配:将顶点数据计算成一个个图元,在这个阶段会执行裁剪、透视分割、视口(viewport)变换等操作。

光栅化

光栅化就是将图元转化成一组二维片段的过程,转化完成后的数据将传递给片元着色器进行渲染、绘制。


光栅化.png

片元着色器

含义

片元着色器 —— 描述片段上执行操作的片元着色器程序源代码/可执行文件

输入

片元着色器.png

输出

业务

EGL

OpenGL ES API 并没有提供如何创建渲染上下⽂或者上下⽂如何连接到原⽣窗⼝系
统,EGL 是Khronos 渲染API(如OpenGL ES) 和原⽣窗⼝系统之间的接⼝。

唯一支持OpenGL ES却不支持EGL的平台是iOS,所以苹果提供自己的EGL API的iOS实现,称为EAGL

上一篇下一篇

猜你喜欢

热点阅读