简体   繁体   English

带有曲面细分着色器的GL_Triangles

[英]GL_Triangles with Tessellation Shaders

When i am using Tessellation Shaders, do I have to pass from my CPU Program Patches rather then Triangles?. 当我使用Tessellation着色器时,我是否必须从我的CPU程序补丁而不是三角形传递?

    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? 它可以是一个被细分的三角形吗?

A patch is just a collection of points with no real intrinsic structure... your TCS and TES are what make sense out of them. 补丁只是一个没有真正内在结构的点的集合......你的TCS和TES是有意义的。 Unlike GL_TRIANGLES (which is strictly defined by 3 vertices), GL_PATCHES has no pre-defined number of vertices per-patch. GL_TRIANGLES (由3个顶点严格定义)不同, GL_PATCHES每个补丁没有预定义的顶点数。 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

Then, every N -many vertices drawn defines a new patch primitive. 然后,绘制的每个N many顶点定义一个新的补丁基元。

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 . 这就是为什么有一个称为Tessellation Control Shader可选阶段,它将数据提供给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 (eg GL_POINTS ). 如果没有关于您正在评估的表面类型的更多详细信息,关于它们可视化的唯一方法是作为点云(例如GL_POINTS )。

Update: 更新:

Assuming you are discussing a Bézier surface , then the control points can be visualized thus: 假设您正在讨论Bézier曲面 ,那么可以将控制点可视化:

贝塞尔曲面

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). 红点是控制点( GL_PATCHES顶点),蓝线是人工的(仅为了可视化),黑色方块是评估表面(曲面细分评估着色器的结果)。 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. 如果您在镶嵌细分评估之前尝试将其可视化,那么您的补丁将只是红点,您可能会有一段时间试图理解它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM