如何表示顶点网格并使用openGL绘制它?

如何表示顶点网格并使用openGL绘制它?,opengl,plugins,data-structures,mesh,maya,Opengl,Plugins,Data Structures,Mesh,Maya,我被要求更改Maya的apiMeshShape插件中的网格数据结构。所以现在我想用opengl绘制一个以顶点结构表示的3D网格 1) 首先,我不知道如何精确地表示顶点网格。我想知道下面的数据结构是否合适 MPointArray vertices; //the position of all the vertices MIntArray vertices_connects_counts; //how many other vertices each vertex connect wit

我被要求更改Maya的apiMeshShape插件中的网格数据结构。所以现在我想用opengl绘制一个以顶点结构表示的3D网格

1) 首先,我不知道如何精确地表示顶点网格。我想知道下面的数据结构是否合适

MPointArray vertices;    //the position of all the vertices
MIntArray vertices_connects_counts;    //how many other vertices each vertex connect with
MIntArray vertices_connects;    //the index array storing each the vertices' index connected with all the vertices
以中的多维数据集示例为例

vertices_connects_counts = {5,5,5,5,5,5,5,5,4,4};
vertices_connects = {1,5,4,3,9,
                    2,6,5,0,9,
                    3,7,6,1,9,
                    2,6,7,4,9,
                    5,0,3,7,8,
                    6,1,0,4,8,
                    7,2,1,5,8,
                    4,3,2,6,8,
                    5,6,7,8,                                       
                    0,1,2,3 };
2) 其次,如果上面的数据结构是正确的,我想知道如何使用openGL绘制网格?我应该将哪个参数传递到glBegin()?

1),这是一个满足所述需求的功能数据结构

2) 请允许我引用您链接的维基百科文章:

但是由于人脸和边缘信息是隐式的,因此没有得到广泛的应用。因此,有必要遍历数据以生成用于渲染的面列表


这就是你必须做的。如果您坚持保留此数据结构(我不会),那么您将不得不遍历连接图并构建顶点面列表。然后您将有数据发送到OpenGL。

那么第二个“面顶点”结构如何?它更容易实现吗?谢谢@伊维特罗:这不是什么更容易或更难实现的问题。这是一个你需要它做什么的问题。这是一个完全不同的问题。