GLSL 高级教程 – Primitive Assembly
来源:互联网 发布:网络管理专业 编辑:程序博客网 时间:2024/04/30 10:55
The primitive assembly stage receives as input the processed vertices from the vertex shader, and the vertex connectivity information from the application as specified by in the <code>glDraw*</code> family of OpenGL commands.
The vertex connectivity states how the vertices are connected to create a primitive. Primitives can be points, lines, triangles, or patches. Furthermore, adjacency information can also be made available, i.e. the application may also provide the vertices that make up the adjacent primitives. This information is of use only for the geometry shader, and, if not such shader is active, the adjacency information will be ignored.
As output the primitive assembly produces primitives or patches. For instance, if the input is a sequence of six vertices, and the connectivity information specifies that we are using triangles, the output will be two triangles. For triangle strips, and considering also six vertices, the output will be four triangles.
Patches are the primitive types accepted by the tessellation control shader, available in OpenGL 4+. The number of vertices of patch is not fixed as in the primitives case, and it can vary between 1 and an implementation dependent constant,GL_MAX_PATCH_VERTICES
, vertices per patch.
Graphically, assuming for instance that the primitive type is GL_TRIANGLES, this can be depicted as follows:
The following table shows the possible input connectivity information settings, and the outputs produced, as well as the shaders that use them.
glDraw commandoutput primtiveused in shadersGL_POINTS
points
geometry; fragmentGL_LINES
lines
geometry; fragmentGL_LINE_STRIP
lines
geometry; fragmentGL_LINE_LOOP
lines
geometry; fragmentGL_LINES_ADJACENCY
lines_adjacency
geometryGL_LINE_STRIP_ADJACENCY
lines_adjacency
geometryGL_TRIANGLES
triangles
geometry; fragmentGL_TRIANGLE_STRIP
triangles
geometry; fragmentGL_TRIANGLE_FAN
triangles
geometry; fragmentGL_TRIANGLES_ADJACENCY
triangles_adjacency
geometryGL_TRIANGLE_STRIP_ADJACENCY
triangles_adjacency
geometryGL_PATCHES
patches
tessellation control
Bellow are examples of what can be obtained with points, lines, and triangles. Regarding primitives with adjacency information, the full lines indicate the main primitive, and the dashed lines connect the adjacent vertices. Note the ordering in the graphics, all primitives are ordered counter clock wise.
The geometrical interpretation of a patch is not as linear, so it is not represented in here. See the section on tessellation for more info on patches.
- GLSL 高级教程 – Primitive Assembly
- GLSL 高级教程 – Introduction
- GLSL 高级教程 – Tessellation
- GLSL 高级教程 – Vertex Shader
- GLSL 高级教程 – Geometry Shader
- GLSL 高级教程 – Geometry Shader Examples
- GLSL 高级教程 – Rasterization and Interpolation
- GLSL 高级教程 – Fragment Shader
- GLSL 高级教程 – Pipeline (OpenGL 3.2 – OpenGL 4.2)
- 高级GLSL
- openGL ES 2.0 Primitive Assembly and Rasterization
- GLSL教程(1)【转】
- GLSL教程(1)【转】
- GLSL教程(1)【转】
- GLSL教程(1)【转】
- GLSL教程(1)【转】
- GLSL教程(1)【转】
- GLSL教程(2)【转】
- 找毒酒
- CString ->string 转换
- C++ char wchar_t转换函数接口
- C# class Struct
- 学习android编译的好地方!!
- GLSL 高级教程 – Primitive Assembly
- MD5 BASE 64
- openssl简介-指令x509
- fastreport.net每页合计
- 《匆匆那年》-第二卷 喜欢
- 树形菜单复选框级联选择
- A*算法详解
- 20120726-分析解决“STM8L101单片机IO口模拟串口通讯发生的奇怪现象”
- windows过滤驱动程序设计入门(驱动程序基本结构,设备栈,IRP栈和工作原理)