简体   繁体   English

背面剔除+ GL_TRIANGLE_STRIP?

[英]Back face culling + GL_TRIANGLE_STRIP?

If I've got 4 vertices which I render in this order: 如果我有4个顶点我按此顺序渲染:

2-3
|\|
0-1

using GL_TRIANGLE_STRIP and then I enable back-face culling with the front face defined as CCW, then would the bottom-left triangle be facing me and the other one not? 使用GL_TRIANGLE_STRIP然后我启用背面剔除,正面定义为CCW,然后左下角三角形面向我而另一个不是? If so, what's the most efficient way of rendering a square so that both faces are visible? 如果是这样,那么渲染正方形以使两个面都可见的最有效方法是什么? Do I have to use GL_TRIANGLES and pass down 6 vertices instead of 4? 我是否必须使用GL_TRIANGLES并传递6个顶点而不是4个顶点?

All triangles in triangle strip maintain same direction/winding order. 三角形条带中的所有三角形保持相同的方向/缠绕顺序 They don't flip one after another. 他们不会一个接一个地翻转。 So either both triangles will be towards you or away from you (assuming your primitive is flat square shape (that is convex and doesn't intersect itself) where all vertices belong to same plane). 因此,要么两个三角形都朝向你或远离你(假设你的图元是扁平方形(即凸面并且不相交),其中所有顶点都属于同一平面)。

PS You know, you COULD render trianglestrip primitive in OpenGL application with culling enabled and see for yourself. PS你知道,你可以在OpenGL应用程序中渲染triangletrip原语并启用剔除并亲自查看。

The strip primitive does the right thing with respect to backface culling. 对于背面剔除,条带基元做正确的事情。 You can think of the tris' winding order as being managed so that the order is consistent for each triangle in the strip - eg you can think of the GPU rendering (0,1,2), (2,1,3) ... 您可以将tris的缠绕顺序视为被管理,以便条带中每个三角形的顺序一致 - 例如,您可以考虑GPU渲染(0,1,2),(2,1,3)。 。

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

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