OpenGL ES crash notes 01 - Nice to meet you
这篇笔记完全参照《OpenGL.ES.3.0.Programming.Guide.2nd.Edition》,摘出部分内容只为学习参考。
为什么要用英文:无论是D3D的SDK还是OES的Spec,都是全英文的,学图像的总是要能看懂的。此外,本人的英语和中文水平有限,翻译的很粗糙,大家可以看原文。
为什么要用中文:一来增强一下自己的理解,二来能够分享给大家,希望能找到更多的人相互讨论学习。
1. Overview
1.1 Pipeline
OpenGL ES 3.0 implements a graphics pipeline with programmable shading and consists of two specifications:
OpenGL ES 3.0利用可编程着色来实现图像管线,包括两份技术说明:
OpenGL ES 3.0 API specification;
OpenGL ES Shading Language 3.0 Specification (OpenGL ES SL).
1.2 Vertex Sharder
The vertex shader implements a general-purpose programmable method for operating on vertices.
Vertex Shader实现一种多用途的方法来对顶点进行处理。
Input:
Shader program - Code;
Vertex shader inputs (or attributes) - Per-vertex data supplied using vertex arrays;
Uniforms - Constant data;
Samplers - Specific types of uniforms that represent textures used by the vertex shader.
Outputs:
In the primitive rasterization stage, the vertex shader output values are calculated for each generated fragment and are passed in as inputs to the fragment shader.
在光栅化阶段,Vertex Shader的输出将被用来计算生成的fragment并作为输入传递给Fragment Shader。
Additionally, OpenGL ES 3.0 adds a new feature called transform feedback, which allows the vertex shader outputs to be selectively written to an output buffer (in addition to, or instead of, being passed to the fragment shader).
此外, OpenGL ES 3.0增加了一个新特性: transform feedback,它能够使Vertex Shader的输出有选择性的写入到一个输出buffer,而不是传递给Fragment Shader。
For example,a particle system can be implemented in the vertex shader in which particles are output to a buffer object using transform feedback.
例如,一个粒子系统就是在将粒子作为输出利用transform feedback传到一个buffer object的Vertex Shader中实现的。
Vertex shaders can be used for traditional vertex-based operations such as transforming the position by a matrix, computing the lighting equation to generate a per-vertex color, and generating or transforming texture coordinates. Alternatively, because the vertex shader is specified by the application, vertex shaders can be used to perform custom math that enables new transforms, lighting, or vertex-based effects not allowed in more traditional fixed-function pipelines.
Vertex Shaders能够做一些传统的基于顶点的操作,比如用矩阵做位置变换、计算光线方程来产生顶点的颜色、产生或者变换纹理坐标。此外,Vertex Shader是可编程的,它能够进行常规的数学计算从而做一些新的变换、光线或者一些基于顶点的效果,这些是传统的固定管线做不到的。
1.3 Primitive Assembly
A primitive is a geometric object such as a triangle, line, or point sprite.
图元(primitive)是一个几何物体比如三角形、线段或者点。
Each vertex of a primitive is sent to a different copy of the vertex shader.During primitive assembly, these vertices are grouped back into the primitive.
每个图元的顶点会被送到不同的Vertex Shader中去。通过这个Primitive Assembly,这些顶点将被重新组合到图元。
If the primitive is not completely inside the view frustum (the region of 3D space that is visible on the screen), it might need to be clipped to the view frustum.If the primitive is completely outside this region, it is discarded.
如果图元没有完全在视域(在屏幕上可见的三维空间区域)中,那么它其余的部分将被裁剪。如果整个图元都在视域之外,它将被丢弃。
A culling operation can also be performed that discards primitives based on whether they face forward or backward.
根据图元的图元当前是正面或者反面来进行剔除操作丢弃图元。
1.4 Rasterization
Rasterization is the process that converts primitives into a set of two-dimensional fragments(represent pixels that can be drawn on the screen), which are then processed by the fragment shader.
光栅化就是将图元转换成一些列二维fragments(表示将被画在屏幕上的像素点)的过程。这些fragments之后会由Fragment Shader处理。
1.5 Fragment Shader
The fragment shader implements a general-purpose programmable method for operating on fragments.
Fragment Shader实现一种多用途的方法来对fragments进行处理。
Inputs:
Shader program - code
Input variables - Outputs of the vertex shader that are generated by the rasterization unit for each fragment using interpolation.
Uniforms - Constant data
Samplers - Specific types of uniforms that represent textures used by the fragment shader.
The fragment shader can either discard the fragment or generate one or more color values referred to as outputs.Typically, the fragment shader outputs just a single color value, except when rendering to multiple render targets(a color value is output for each render target).
Fragment Shader会丢弃一些顶点,或产生一种或多种颜色值作为输出。除了当多目标渲染(一个颜色值输出到各个目标)的情况之外,Fragment Shader的输出一般就是一个颜色值。
1.6 Per-Fragment Operations
A fragment produced by rasterization with (xw, yw) screen coordinates can only modify the pixel at location (xw, yw) in the framebuffer.
一个屏幕坐标(xw,yw)由光栅化产生的fragment仅仅只能被在Frambuffer中(xw,yw)位置的像素来修改。
Pixel ownership test - This test determines whether the pixel atlocation (xw, yw) in the framebuffer is currently owned by OpenGLES. it is not controlled by the developer, but rather takes place internally inside of OpenGL ES.
这个测试决定了在Frambuffer中(xw,yw)位置的像素现在是否属于OpenGLES。它在OpenGL ES内实现,不由开发者操控。
Scissor test - The scissor test determines whether (xw, yw) lies within the scissor rectangle defined as part of the OpenGL ES state.
剪裁测试决定点(xw, yw)是否在由OpenGL ES state定义的剪裁矩形内。
Stencil and depth tests - These tests are performed on the stencil and depth value of the incoming fragment to determine whether the fragment should be rejected.
深度模板测试根据输入fragment的深度和模板值来决定该fragment是否会被丢弃。
Blending—Blending combines the newly generated fragment color value with the color values stored in the framebuffer at location (xw, yw).
混色将新产生的fragment颜色值和存储在在Frambuffer中(xw,yw)位置的颜色值混合。
Dithering - Dithering can be used to minimize the artifacts that occur as a result of using limited precision to store color values in the framebuffer.
抖动用来最小化在Framebuffer中用有限精度来存储颜色值带来的误差。
At the end of the per-fragment stage, either the fragment is rejected or a fragment color(s), depth, or stencil value is written to the framebuffer at location (xw, yw).
在Per-Fragment阶段的最后,一个fragment要么被丢弃,要么它的颜色、深度、模板值将被写入Framebuffer的(xw, yw).位置。
转载请注明出处:
http://www.cnblogs.com/lvrcbl/p/3948641.html
OpenGL ES crash notes 01 - Nice to meet you的更多相关文章
- 基于Cocos2d-x学习OpenGL ES 2.0系列——你的第一个三角形(1)
前言 在本系列教程中,我会以当下最流行的2D引擎Cocos2d-x为基础,介绍OpenGL ES 2.0的一些基本用法.本系列教程的宗旨是OpenGL扫盲,让大家在使用Cocos2d-x过程中,知其然 ...
- 在 OpenGL ES 2.0 上实现视差贴图(Parallax Mapping)
在 OpenGL ES 2.0 上实现视差贴图(Parallax Mapping) 视差贴图 最近一直在研究如何在我的 iPad 2(只支持 OpenGL ES 2.0, 不支持 3.0) 上实现 视 ...
- [OpenGL ES 03]3D变换:模型,视图,投影与Viewport
[OpenGL ES 03]3D变换:模型,视图,投影与Viewport 罗朝辉 (http://blog.csdn.net/kesalin) 本文遵循“署名-非商业用途-保持一致”创作公用协议 系列 ...
- OpenGL ES学习笔记(一)——基本用法、绘制流程与着色器编译
首先声明下,本文为笔者学习<OpenGL ES应用开发实践指南(Android卷)>的笔记,涉及的代码均出自原书,如有需要,请到原书指定源码地址下载. 在Android.iOS等移动平台上 ...
- Beginning OpenGL ES 2.0 with GLKit Part 1
Update 10/24/12: If you’d like a new version of this tutorial fully updated for iOS 6 and Xcode 4.5, ...
- OpenGL ES 如何能看到一个物体内部和象3dmax中能只显示网格线
上一篇 OpenGL ES 正反面设置指令 中分析了正反面的判区方法,那么正反面有什么用呢?接下来我们就要引入一个叫做背面消除的概念.在3dmax中有个选项,当你用挤压修改器挤出一个中空的长方体时,在 ...
- OpenGL ES 响应屏幕旋转 iOS
iOS下使用OpenGL 如果使用GLKit View 那么不用担心屏幕旋转的问题,说明如下: If you change the size, scale factor, or drawable pr ...
- OpenGL ES: iOS 自定义 UIView 响应屏幕旋转
iOS下使用OpenGL 如果使用GLKit View 那么不用担心屏幕旋转的问题,说明如下: If you change the size, scale factor, or drawable pr ...
- OpenGL ES 2.0 Shader 调试新思路(二): 做一个可用的原型
OpenGL ES 2.0 Shader 调试新思路(二): 做一个可用的原型 目录 背景介绍 请参考前文OpenGL ES 2.0 Shader 调试新思路(一): 改变提问方式 优化 ledCha ...
随机推荐
- Click模块化路由器
[概述] Click是一种基于软件控制的模块化路由器.其架构可以大致视为一系列数据包处理模块(称为elements)组成的.一个Click路由器可以看成一张由elements作为顶点,数据包传递路径作 ...
- IOPS-百度百科
IOPS (Input/Output Operations Per Second),即每秒进行读写(I/O)操作的次数,多用于数据库等场合,衡量随机访问的性能.存储端的IOPS性能和主机端的IO是不同 ...
- [C#常用代码]类库中读取解决方案web.Config字符串
对于类库里读取解决方案web.config文件里字符串的方法一.读取键值对的方法:1.添加引用using System.Configuration;2.web.Config配置节<appSett ...
- ExpressJs server中Router的设置
expressjs的路由设置方法 一.基本方法: app.METHOD(PATH, HANDLER)把路径path和操作方法method(可以是http的get/put/delete等),映射到一个处 ...
- 修改BIND9实现TCP DNS
近日适逢某平方节日,Google国外网站陆续出现被墙的状况,想必大家都是知道的. 其实本人一直在使用SSH的Socket代理功能爬梯子,效果还是不错的,加上学校有原生IPv6支持,就算不走代理一般也能 ...
- Java多线程Thread
转自:http://www.cnblogs.com/lwbqqyumidi/p/3804883.html Java总结篇系列:Java多线程(一) 多线程作为Java中很重要的一个知识点,在此还是 ...
- linux mail 使用外部邮箱地址发邮件
centos 61.系统yum安装的mailx会默认使用本地sendmail发送邮件,这样要求本地的机器必须安装和启动Sendmail服务,配置麻烦,而且会带来不必要的资源占用.通过修改配置文件可以使 ...
- shell命令快捷键
在shell命令终端中,Ctrl+n相当于方向向下的方向键,Ctrl+p相当于方向向上的方向键. 在命令终端中通过它们或者方向键可以实现对历史命令的快速查找.这也是快速输入命令的技巧. 在命令 ...
- 实现iframe 全屏显示
componentDidMount(){var elem = document.getElementById('iframe');; var elem = document.getElementByI ...
- 扩展jquery的选择器
I’m sure you all know that it’s possible to create plugins and extend various aspects of the jQuery ...