OpenGL 规范。说:
The variable
gl_PrimitiveID
is filled with the number of primitives processed by the drawing command which generated the input vertices. The first primitive generated by a drawing command is numbered zero, and the primitive ID counter is incremented after every individual point, line, or triangle primitive is processed. Restarting a primitive topology using the primitive restart index has no effect on the primitive ID counter.
不幸的是,我不太明白。
如果我使用 GL_PATCHES
进行绘制调用,顶点数 = 32,则所有 32 顶点都具有 gl_PrimitiveID
= 0 在曲面分割控制着色器中?
曲面分割控制着色器仍然输出补丁,并且补丁是单个基元。
假设当该面片在曲面分割评估着色器中曲面分割为三角形时,每个第 n 个顶点都会有其 gl_PrimitiveID
= n/3?
如果不是,请解释它们的值是什么。
最佳答案
OpenGL 维基 seems to agree :
gl_PrimitiveID
the index of the current patch within this rendering command.
如果您需要确认,在规范中查找这一点应该不难。
我猜想当您处理足够的顶点并开始新的补丁时,渲染命令中的补丁数量就会发生变化。
关于opengl - gl_PrimitiveID 在曲面分割控制和评估着色器中如何解释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24198598/