GL_Triangles带有细分着色器 [英] GL_Triangles with Tessellation Shaders
问题描述
当我使用Tessellation着色器时,是否必须从我的CPU程序补丁而不是Triangles中传递?
When i am using Tessellation Shaders, do I have to pass from my CPU Program Patches rather then Triangles?.
glDrawArrays(GL_PATCHES, 0, 3); //Works with Tess Shaders
glDrawArrays(GL_TRIANGLES, 0, 3); //Works not with Tess Shaders
什么是完全可视化的补丁?可以是被细分的三角形吗?
What is a Patch exactly to visualize it? Can it be a triangle which is being subdivided?
推荐答案
补丁只是点的集合,没有真正的内在结构……您的TCS和TES才是有意义的.与GL_TRIANGLES
(严格由3个顶点定义)不同,GL_PATCHES
每个修补程序没有预定义的顶点数.您可以使用以下命令自己设置补丁中的顶点数:
A patch is just a collection of points with no real intrinsic structure... your TCS and TES are what make sense out of them. Unlike GL_TRIANGLES
(which is strictly defined by 3 vertices), GL_PATCHES
has no pre-defined number of vertices per-patch. You set the number of vertices in a patch yourself with:
glPatchParameteri (GL_PATCH_VERTICES, N);
// where N is some value less than GL_MAX_PATCH_VERTICES
然后,每个绘制的每个N
个顶点都定义一个新的面片基元.
Then, every N
-many vertices drawn defines a new patch primitive.
补丁实际上只是用于评估表面的控制点的集合.从字面上看,这就是为什么有一个名为Tessellation Control Shader
的 optional 阶段将数据馈送到Tessellation Evaluation Shader
的原因.没有更多关于您要评估的表面类型的详细信息,关于将其可视化的唯一方法是将其作为点云(例如GL_POINTS
).
Patches are really just a collection of control points for the evaluation of a surface. This is literally why there is an optional stage called Tessellation Control Shader
that feeds data to a Tessellation Evaluation Shader
. Without more details about the type of surface you are evaluating, about the only way to visualize them is as a point cloud (e.g. GL_POINTS
).
红色点是控制点(GL_PATCHES
中的顶点),蓝色线是人造的(仅出于可视化目的),黑色正方形是被评估的曲面(镶嵌细分评估着色器"的结果).如果您在细分化评估之前尝试将其可视化,那么您的补丁只会是红点而已,您将有一段时间尝试理解它们.
The red points are the control points (vertices in GL_PATCHES
), the blue lines are artifical (just for the sake of visualization) and the black squares are the evaluated surface (result of a Tessellation Evaluation Shader). If you tried to visualize this before tessellation evaluation, then your patch would be nothing but red dots and you would have a heck of a time trying to make sense of them.
这篇关于GL_Triangles带有细分着色器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!