我有一个名为Point
(恰好是 Python 扩展)的结构,如下所示:
struct Point {
PyObject_HEAD // Macro that expands to include a few more members
double x;
double y;
};
我还有另一个结构,它将在两个数组中保存一堆这些:
struct Polygon {
int length;
Point **vertex_points;
Point **texcrd_points;
}
我想用这些来映射多边形的顶点和纹理坐标与顶点数组。问题是顶点数组需要以下格式的数组:
[x, y, x, y, x, y, etc]
有没有办法可以用and调用glVertexPointer
and ,或者我必须构造与 gl*Pointer 期望的匹配的新数组?glTexCoordPointer
Polygon->vertex_points
Polygon->texcrd_points