Reputation: 1073
I am in the process of converting a Web GL application into iOS.
The web gl version of the app uses the gl-matrix package (https://github.com/toji/gl-matrix) to perform matrix and vector operations.
I was wondering what the equivalent package would be in iOS?
For instance one of the lines of code in the javascript application uses the line:
return new glMatrixArrayType([x * sin2, y * sin2, z * sin2, Math.cos(a2)]);
In iOS what should I use instead of glMatrixArrayType.
Cheers, Sam
Upvotes: 0
Views: 238
Reputation: 100632
Assuming you mean iOS 5+, the equivalent is GLKit. Prior to that you were on your own as far as the OS was concerned.
It doesn't have a 2x2 matrix so the equivalent to that line of code would be (well, probably, unless I've got my rows and columns transposed — I don't know gl-matrix):
return GLKMatrix3Make(
x * sin2, y * sin2, 0.0f,
z*sin2, cos(a2), 0.0f,
0.0f, 0.0f, 1.0f);
Upvotes: 2