镶嵌着色器-OpenGL [英] Tessellation Shader - OpenGL
问题描述
layout (vertices = 3) out;
void main(void)
{
if (gl_InvocationID == 0)
{
gl_TessLevelInner[0] = 5.0;
gl_TessLevelOuter[0] = 5.0;
gl_TessLevelOuter[1] = 5.0;
gl_TessLevelOuter[2] = 5.0;
}
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
}
节选自:尼古拉斯·海梅尔. "OpenGL SuperBible:
Excerpt From: Haemel, Nicholas. "OpenGL SuperBible:
我如何理解TessLevelInner和Outer,为什么ID 0被列出两次?
How can i understand TessLevelInner and Outer and why is the id 0 listed two times?
推荐答案
我如何理解
gl_TessLevelInner
和gl_TessLevelOuter
?
请参阅:
gl_TessLevelInner
, OpenGL细分-级别
顾名思义,它们控制要处理的图元的内部和外部镶嵌因子级别.下图显示了各种内部/外部级别设置的结果.
As their names imply, they control the inner and outer tessellation factor levels for the primitive being processed. Below is an image illustrating the results of various inner/outer level settings.
来源: http://antongerdelan.net/opengl/tessellation.html
为什么索引
0
被使用两次?
它被使用两次,因为它正在访问两个不同的对象.索引0
的首次使用是
It is used twice because it is accessing two different objects. The first use of index 0
is with
gl_TessLevelInner[0]
第二个是
gl_TessLevelOuter[0]
这篇关于镶嵌着色器-OpenGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!