-7

我有下面的代码,我想将一个数组 meshVerts 传递给下面的方法:

- (GLuint)make:(float *)cubeVerts {

    GLuint _vertexArray;
    GLuint _vertexBuffer;

    glEnable(GL_DEPTH_TEST);

    glGenVertexArraysOES(1, &_vertexArray);
    glBindVertexArrayOES(_vertexArray);

    glGenBuffers(1, &_vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVerts), cubeVerts, GL_STATIC_DRAW);

}

但是,这似乎对我不起作用?有什么我做错了吗?

在此处输入图像描述

4

1 回答 1

0

对不起,我在帖子中的错字......这是我设法修复它的方法:

- (GLuint)make:(float[])meshVerts withSizeOfMeshVerts:(int)sizeMeshVerts
{
        GLuint _vertexArray;
        GLuint _vertexBuffer;

        glEnable(GL_DEPTH_TEST);

        glGenVertexArraysOES(1, &_vertexArray);
        glBindVertexArrayOES(_vertexArray);

        glGenBuffers(1, &_vertexBuffer);
        glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
        glBufferData(GL_ARRAY_BUFFER, sizeMeshVerts, meshVerts, GL_STATIC_DRAW);
}
于 2012-12-12T11:54:00.053 回答