我正在尝试通过函数传递GLfloat类型数组,但新变量只取数组的第一个值(在这种情况下为0.5f),我做错了什么?
我的代码:
void main()
{
// some code
GLfloat vertices[] = {
// Positions // Colors // Texture Coords
0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // Top Right
0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // Bottom Right
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // Bottom Left
-0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // Top Left
};
passingArray(vertices);
}
void passingArray(GLfloat anotherVertices[])
{
// this anotherVertices only take 1st value of the vertices array
}