0

我希望我的班级Vector3f为我的长方体(由三角形制成)存储索引点。

这是我要推送到向量的内容。

    vector<Vector3f> I;

    I.push_back(Vector3f(1,   0,   2));     //front
    I.push_back(Vector3f(2,   0,   3));
    I.push_back(Vector3f(4,   5,   7));         //back
    I.push_back(Vector3f(7,   5,   6));
    I.push_back(Vector3f(0,   4,   3));     //left
    I.push_back(Vector3f(3,   4,   7));     
    I.push_back(Vector3f(5,   1,   6));     //right
    I.push_back(Vector3f(6,   1,   2));
    I.push_back(Vector3f(7,   6,   3));     //up
    I.push_back(Vector3f(3,   6,   2));
    I.push_back(Vector3f(1,   0,   5));     //down
    I.push_back(Vector3f(5,   0,   4));

顶点数组可以从类中读取吗?

4

1 回答 1

1

假设您的 Vector3f 是 POD

&I[0]会给你一个float *你可以传递给glBufferData

于 2013-04-20T21:35:09.870 回答