将顶点数据与矩阵相乘 iOS

Multiply vertex data with a matrix iOS

我找到了一种方法来获取对象的转换顶点数据,他们说我必须将顶点数据与 matrix.But 我不知道该怎么做。 我有

GLfloat gCubeVertexData[216] = 
{
0.5f, -0.5f, -1.0f,        1.0f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f,         1.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f,         1.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f,         1.0f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f,          1.0f, 0.0f, 0.0f,
0.5f, 0.5f, 0.5f,         1.0f, 0.0f, 0.0f,

etc.
};

和矩阵

感谢您的宝贵时间:)

假设您的矩阵也是一个浮点数数组。先做一个GLKMatrix4对象。

然后使用 Perform Mathematical Operations on Vectors

中的一种方法将 gCubeVertexData 中的每个顶点 (x,y,z) 相乘