GLKMatrix4 Reference
Overview
The GLKMatrix4
type defines a 4x4
floatingpoint matrix as well as many mathematical operations commonly used to manipulate matrices. 3D graphics programming uses matrices extensively as a convenient way to represent a graphical transformation between different coordinate systems. These transformations include translation, scaling, rotation and projection; through matrix multiplication, multiple transformations can be concatenated into a single transformation matrix.
The functions that manipulate GLKMatrix4
structures treat the inputs as immutable, instead returning a new matrix that represent the results of the operation.
Functions by Task
Creating Matrices

GLKMatrix4Make

GLKMatrix4MakeAndTranspose

GLKMatrix4MakeWithArray

GLKMatrix4MakeWithArrayAndTranspose

GLKMatrix4MakeWithColumns

GLKMatrix4MakeWithRows

GLKMatrix4MakeRotation

GLKMatrix4MakeXRotation

GLKMatrix4MakeYRotation

GLKMatrix4MakeZRotation

GLKMatrix4MakeWithQuaternion

GLKMatrix4MakeScale

GLKMatrix4MakeTranslation

GLKMatrix4MakeLookAt

GLKMatrix4MakeOrtho

GLKMatrix4MakePerspective

GLKMatrix4MakeFrustum
Working With Parts of a Matrix

GLKMatrix4GetMatrix2

GLKMatrix4GetMatrix3

GLKMatrix4GetColumn

GLKMatrix4GetRow

GLKMatrix4SetColumn

GLKMatrix4SetRow
Performing Mathematical Operations on Matrices

GLKMatrix4Invert

GLKMatrix4Transpose

GLKMatrix4InvertAndTranspose

GLKMatrix4Multiply

GLKMatrix4Rotate

GLKMatrix4RotateWithVector3

GLKMatrix4RotateWithVector4

GLKMatrix4RotateX

GLKMatrix4RotateY

GLKMatrix4RotateZ

GLKMatrix4Scale

GLKMatrix4ScaleWithVector3

GLKMatrix4ScaleWithVector4

GLKMatrix4Translate

GLKMatrix4TranslateWithVector3

GLKMatrix4TranslateWithVector4

GLKMatrix4Add

GLKMatrix4Subtract
Performing Mathematical Operations on Vectors
Functions
GLKMatrix4Add
Returns a new 4x4
matrix created by performing a componentwise addition of two matrices.
GLKMatrix4 GLKMatrix3Add ( GLKMatrix4 matrixLeft, GLKMatrix4 matrixRight );
Parameters
 matrixLeft
The first matrix.
 matrixRight
The second matrix.
Return Value
A new matrix whose components each represent the sum of the components found in the same positions of the two source matrices.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4GetColumn
Retrieves a column from a 4x4
matrix.
GLKVector4 GLKMatrix4GetColumn ( GLKMatrix4 matrix, int column );
Parameters
 matrix
A
4x4
matrix. column
The column index, which must be a number between
0
and3
, inclusive.
Return Value
A vector representing the column retrieved from the matrix.
Discussion
The first three components of column 3
provide the translation values tx
, ty
and tz
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4GetMatrix2
Returns the upperleft 2x2
section of a 4x4
matrix.
GLKMatrix2 GLKMatrix4GetMatrix2 ( GLKMatrix4 matrix );
Parameters
 matrix
A
4x4
matrix.
Return Value
A new 2x2
matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4GetMatrix3
Returns the upperleft 3x3
section of a 4x4
matrix.
GLKMatrix3 GLKMatrix4GetMatrix3 ( GLKMatrix4 matrix );
Parameters
 matrix
A
4x4
matrix.
Return Value
A new 3x3
matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4GetRow
Retrieves a row from a 4x4
matrix.
GLKVector4 GLKMatrix4GetRow ( GLKMatrix4 matrix, int row );
Parameters
 matrix
A
4x4
matrix. row
The row index, which must be a number between
0
and3
, inclusive.
Return Value
A vector representing the row retrieved from the matrix.
Discussion
The last component of rows 0
through 2
correspond to the translation values tx
, ty
, and tz
, respectively.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Invert
Returns the inverse of a matrix.
GLKMatrix4 GLKMatrix4Invert ( GLKMatrix4 matrix, bool *isInvertible );
Parameters
 matrix
A
4x4
matrix. isInvertible
On return, this holds
YES
if the matrix was inverted orNO
if the matrix is not invertible.
Return Value
If isInvertible was set to YES
, this holds an inverted matrix. Otherwise, the identity matrix is returned.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4InvertAndTranspose
Returns the inverse transpose of a matrix.
GLKMatrix4 GLKMatrix4InvertAndTranspose ( GLKMatrix4 matrix, bool *isInvertible );
Parameters
 matrix
A
4x4
matrix. isInvertible
On return, this holds
YES
if the matrix was inverted orNO
if the matrix is not invertible.
Return Value
If isInvertible was set to YES
, this holds an inverted and transposed matrix. Otherwise, the identity matrix is returned.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Make
Returns a 4x4
matrix created from individual component values.
GLKMatrix4 GLKMatrix4Make ( float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33 );
Parameters
 m00
The value for position [0,0] in the returned matrix.
 m01
The value for position [0,1] in the returned matrix.
 m02
The value for position [0,2] in the returned matrix.
 m03
The value for position [0,3] in the returned matrix.
 m10
The value for position [1,0] in the returned matrix.
 m11
The value for position [1,1] in the returned matrix.
 m12
The value for position [1,2] in the returned matrix.
 m13
The value for position [1,3] in the returned matrix.
 m20
The value for position [2,0] in the returned matrix.
 m21
The value for position [2,1] in the returned matrix.
 m22
The value for position [2,2] in the returned matrix.
 m23
The value at position [2,3] in the returned matrix.
 m30
The value for position [3,0] in the returned matrix.
 m31
The value for position [3,1] in the returned matrix.
 m32
The value for position [3,2] in the returned matrix.
 m33
The value for position [3,3] in the returned matrix.
Return Value
A new matrix.
Discussion
The values in m30
, m31
, and m32
correspond to the translation values tx
, ty
, and tz
, respectively.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeAndTranspose
Returns a 4x4
transposed matrix created from individual component values.
GLKMatrix4 GLKMatrix4MakeAndTranspose ( float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33 );
Parameters
 m00
The value for position [0,0] in the returned matrix.
 m01
The value for position [1,0] in the returned matrix.
 m02
The value for position [2,0] in the returned matrix.
 m03
The value for position [3,0] in the returned matrix.
 m10
The value for position [0,1] in the returned matrix.
 m11
The value for position [1,1] in the returned matrix.
 m12
The value for position [2,1] in the returned matrix.
 m13
The value for position [3,1] in the returned matrix.
 m20
The value for position [0,2] in the returned matrix.
 m21
The value for position [1,2] in the returned matrix.
 m22
The value for position [2,2] in the returned matrix.
 m23
The value for position [3,2] in the returned matrix.
 m30
The value for position [0,3] in the returned matrix.
 m31
The value for position [1,3] in the returned matrix.
 m32
The value for position [2,3] in the returned matrix.
 m33
The value for position [3,3] in the returned matrix.
Return Value
A new matrix.
Discussion
The values in m03
, m13
, and m23
correspond to the translation values tx
, ty
, and tz
, respectively.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeFrustum
Returns a 4x4
perspective projection matrix.
GLKMatrix4 GLKMatrix4MakeFrustum ( float left, float right, float bottom, float top, float nearZ, float farZ );
Parameters
 left
The left clipping plane.
 right
The right clipping plane.
 bottom
The bottom clipping plane.
 top
The top clipping plane.
 nearZ
The near clipping distance. Must be positive.
 farZ
The far clipping distance. Must be positive and greater than the near distance.
Return Value
A projection matrix.
Discussion
This function creates the same orthographic projection matrix previously provided in OpenGL ES 1.1 by the glFrustum
function.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeLookAt
Returns a 4x4
matrix that transforms world coordinates to eye coordinates.
GLKMatrix4 GLKMatrix4MakeLookAt ( float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ );
Parameters
 eyeX
The
x
coordinate of the eye position. eyeY
The
y
coordinate of the eye position. eyeZ
The
z
coordinate of the point position. centerX
The
x
coordinate of the point being looked at. centerY
The
y
coordinate of the point being looked at. centerZ
The
z
coordinate of the point being looked at. upX
The
x
coordinate of the camera’s up vector. upY
The
y
coordinate of the camera’s up vector. upZ
The
z
coordinate of the camera’s up vector.
Return Value
A newly initialized view matrix.
Discussion
This function creates a matrix in a way similar to the gluLookAt
function previously provided in OpenGL ES 1.1.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeOrtho
Returns a 4x4
orthographic projection matrix.
GLKMatrix4 GLKMatrix4MakeOrtho ( float left, float right, float bottom, float top, float nearZ, float farZ );
Parameters
 left
The left coordinate of the projection volume in eye coordinates.
 right
The right coordinate of the projection volume in eye coordinates.
 bottom
The bottom coordinate of the projection volume in eye coordinates.
 top
The top coordinate of the projection volume in eye coordinates.
 nearZ
The near coordinate of the projection volume in eye coordinates. Must be positive.
 farZ
The far coordinate of the projection volume in eye coordinates. Must be positive and greater than the near distance.
Return Value
A new projection matrix.
Discussion
This function creates the same orthographic projection matrix previously provided in OpenGL ES 1.1 by the glOrtho
function.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakePerspective
Returns a 4x4
perspective projection matrix.
GLKMatrix4 GLKMatrix4MakePerspective ( float fovyRadians, float aspect, float nearZ, float farZ );
Parameters
 fovyRadians
The angle of the vertical viewing area.
 aspect
The ratio between the horizontal and the vertical viewing area.
 nearZ
The near clipping distance. Must be positive.
 farZ
The far clipping distance. Must be positive and greater than the near distance.
Return Value
A new projection matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeRotation
Returns a 4x4
matrix that performs a rotation around an arbitrary vector.
GLKMatrix4 GLKMatrix4MakeRotation ( float radians, float x, float y, float z );
Parameters
 radians
The angle of the rotation (a positive angle is counterclockwise).
 x
The
x
component of the rotation vector. y
The
y
component of the rotation vector. z
The
z
component of the rotation vector.
Return Value
A new rotation matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeScale
Returns a 4x4
matrix that performs a scaling transformation.
GLKMatrix4 GLKMatrix4MakeScale ( float sx, float sy, float sz );
Parameters
 sx
The amount to scale the
x
component. sy
The amount to scale the
y
component. sz
The amount to scale the
z
component.
Return Value
A new scaling matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeTranslation
Returns a 4x4
matrix that performs a translation.
GLKMatrix4 GLKMatrix4MakeTranslation ( float tx, float ty, float tz );
Parameters
 tx
The amount to translate the
x
component. ty
The amount to translate the
y
component. tz
The amount to translate the
z
component.
Return Value
A new translation matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeWithArray
Returns a 4x4
matrix created from an array of component values.
GLKMatrix4 GLKMatrix4MakeWithArray ( float values[16] );
Parameters
 float values[16]
An array of component values, in columnmajor order.
Return Value
A new matrix.
Discussion
The values at indices 12
, 13
, and 14
correspond to the translation values tx
, ty
, and tz
, respectively.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeWithArrayAndTranspose
Returns a 4x4
transposed matrix created from an array of component values.
GLKMatrix4 GLKMatrix4MakeWithArrayAndTranspose ( float values[16] );
Parameters
 float values[16]
An array of component values, in columnmajor order.
Return Value
A new matrix.
Discussion
The matrix is created and then transposed, before being returned to your application.
The values at indices 3
, 7
, and 11
correspond to the translation values tx
, ty
, and tz
, respectively.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeWithColumns
Returns a 4x4
matrix created from four column vectors.
GLKMatrix4 GLKMatrix4MakeWithColumns ( GLKVector4 column0, GLKVector4 column1, GLKVector4 column2, GLKVector4 column3 );
Parameters
 column0
The first column.
 column1
The second column.
 column2
The third column.
 column3
The four column.
Return Value
A new matrix.
Discussion
The first three components of the column3
parameter provide the translation values for the matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeWithQuaternion
Returns a 4x4
matrix that performs a rotation based on a quaternion.
GLKMatrix4 GLKMatrix4MakeWithQuaternion ( GLKQuaternion quaternion );
Parameters
 quaternion
The quaternion.
Return Value
A new matrix that provides an equivalent rotation to that stored in the quaternion.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeWithRows
Returns a 4x4
matrix created from four row vectors.
GLKMatrix4 GLKMatrix4MakeWithRows ( GLKVector4 row0, GLKVector4 row1, GLKVector4 row2, GLKVector4 row3 );
Parameters
 row0
The first row. The last component of the vector provides the x coordinate’s translation value.
 row1
The second row. The last component of the vector provides the y coordinate’s translation value.
 row2
The third row. The last component of the vector provides the z coordinate’s translation value.
 row3
The fourth row.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeXRotation
Returns a 4x4
matrix that performs a rotation around the positive xaxis.
GLKMatrix4 GLKMatrix4MakeXRotation ( float radians );
Parameters
 radians
The angle of the rotation (a positive angle is counterclockwise).
Return Value
A new rotation matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeYRotation
Returns a 4x4
matrix that performs a rotation around the positive yaxis.
GLKMatrix4 GLKMatrix4MakeYRotation ( float radians );
Parameters
 radians
The angle of the rotation (a positive angle is counterclockwise).
Return Value
A new rotation matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MakeZRotation
Returns a 4x4
matrix that performs a rotation around the positive zaxis.
GLKMatrix4 GLKMatrix4MakeZRotation ( float radians );
Parameters
 radians
The angle of the rotation (a positive angle is counterclockwise).
Return Value
A new rotation matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Multiply
Returns the product of two matrices.
GLKMatrix4 GLKMatrix4Multiply ( GLKMatrix4 matrixLeft, GLKMatrix4 matrixRight );
Parameters
 matrixLeft
The multiplicand.
 matrixRight
The multiplier.
Return Value
A new matrix created by multiplying the two matrices together.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyAndProjectVector3
Multiplies a 4x4
matrix by a position vector to create a vector in homogenous coordinates, then projects the result to a 3
component vector.
GLKVector3 GLKMatrix4MultiplyAndProjectVector3 ( GLKMatrix4 matrixLeft, GLKVector3 vectorRight );
Parameters
 matrixLeft
The matrix multiplicand.
 vectorRight
The vector multiplier.
Return Value
A new vector created by first multiplying the matrix by the vector and then performing perspective division on the result vector.
Discussion
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyAndProjectVector3Array
Multiplies a 4x4
matrix by an array of 3
component vectors. Each result is projected back to 3
component vector.
void GLKMatrix4MultiplyAndProjectVector3Array ( GLKMatrix4 matrix, GLKVector3 *vectors, size_t vectorCount );
Parameters
 matrix
The matrix multiplicand.
 vectors
On entry, an array of input vectors. On return, an array of output vectors.
 vectorCount
The number of vectors in the array.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyVector3
Multiplies a 4x4
matrix by a 3
component vector.
GLKVector3 GLKMatrix4MultiplyVector3 ( GLKMatrix4 matrixLeft, GLKVector3 vectorRight );
Parameters
 matrixLeft
The matrix multiplicand.
 vectorRight
The vector multiplier.
Return Value
A new vector created by multiplying the matrix by the vector.
Discussion
The input vector is treated as it were a 4component vector with a w
component of 0.0
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyVector3Array
Multiplies a 4x4
matrix by an array of 3
component vectors.
void GLKMatrix4MultiplyVector3Array ( GLKMatrix4 matrix, GLKVector3 *vectors, size_t vectorCount );
Parameters
 matrix
The matrix multiplicand.
 vectors
On entry, an array of input vectors. On return, an array of output vectors.
 vectorCount
The number of vectors in the array.
Discussion
The input vectors are treated as they were 4component vectors with a w
component of 0.0
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyVector3ArrayWithTranslation
Multiplies a 4x4
matrix by an array of 3
component vectors, applying translation.
void GLKMatrix4MultiplyVector3ArrayWithTranslation ( GLKMatrix4 matrix, GLKVector3 *vectors, size_t vectorCount );
Parameters
 matrix
The matrix multiplicand.
 vectors
On entry, an array of input vectors. On return, an array of output vectors.
 vectorCount
The number of vectors in the array.
Discussion
The input vectors are treated as they were 4component vectors with a w
component of 1.0
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyVector3WithTranslation
Multiplies a 4x4
matrix by a 3
component vector, applying translation.
GLKVector3 GLKMatrix4MultiplyVector3WithTranslation ( GLKMatrix4 matrixLeft, GLKVector3 vectorRight );
Parameters
 matrixLeft
The matrix multiplicand.
 vectorRight
The vector multiplier.
Return Value
A new vector created by multiplying the matrix by the vector.
Discussion
The input vector is treated as it were a 4component vector with a w
component of 1.0
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyVector4
Multiplies a 4x4
matrix by a 4
component vector.
GLKVector4 GLKMatrix4MultiplyVector4 ( GLKMatrix4 matrixLeft, GLKVector4 vectorRight );
Parameters
 matrixLeft
The matrix multiplicand.
 vectorRight
The vector multiplier.
Return Value
A new vector created by multiplying the matrix by the vector.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4MultiplyVector4Array
Multiplies a 4x4
matrix by an array of 4
component vectors.
void GLKMatrix4MultiplyVector4Array ( GLKMatrix4 matrix, GLKVector4 *vectors, size_t vectorCount );
Parameters
 matrix
The matrix multiplicand.
 vectors
On entry, an array of input vectors. On return, an array of output vectors.
 vectorCount
The number of vectors in the array.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Rotate
Returns a new 4x4
matrix created by concatenating a matrix with a rotation around a vector.
GLKMatrix4 GLKMatrix4Rotate ( GLKMatrix4 matrix, float radians, float x, float y, float z );
Parameters
 matrix
A matrix.
 radians
The angle of the rotation (a positive angle is counterclockwise).
 x
The
x
component of the rotation vector. y
The
y
component of the rotation vector. z
The
z
component of the rotation vector.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4RotateWithVector3
Returns a new 4x4
matrix created by concatenating a matrix with a rotation around a vector.
GLKMatrix4 GLKMatrix4RotateWithVector3 ( GLKMatrix4 matrix, float radians, GLKVector3 axisVector );
Parameters
 matrix
A matrix.
 radians
The angle of the rotation (a positive angle is counterclockwise).
 axisVector
The axis to perform the rotation around.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4RotateWithVector4
Returns a new 4x4
matrix created by concatenating a matrix with a rotation around a vector.
GLKMatrix4 GLKMatrix4RotateWithVector4 ( GLKMatrix4 matrix, float radians, GLKVector4 axisVector );
Parameters
 matrix
A matrix.
 radians
The angle of the rotation (a positive angle is counterclockwise).
 axisVector
The axis to perform the rotation around.
Return Value
A new matrix.
Discussion
The w
component of the rotation vector is ignored.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4RotateX
Returns a new 4x4
matrix created by concatenating a matrix with a rotation around the xaxis.
GLKMatrix4 GLKMatrix4RotateX ( GLKMatrix4 matrix, float radians );
Parameters
 matrix
A matrix.
 radians
The angle of the rotation (a positive angle is counterclockwise).
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4RotateY
Returns a new 4x4
matrix created by concatenating a matrix with a rotation around the yaxis.
GLKMatrix4 GLKMatrix4RotateY ( GLKMatrix4 matrix, float radians );
Parameters
 matrix
A matrix.
 radians
The angle of the rotation (a positive angle is counterclockwise).
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4RotateZ
Returns a new 4x4
matrix created by concatenating a matrix with a rotation around the zaxis.
GLKMatrix4 GLKMatrix4RotateZ ( GLKMatrix4 matrix, float radians );
Parameters
 matrix
A matrix.
 radians
The angle of the rotation (a positive angle is counterclockwise).
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Scale
Returns a new 4x4
matrix created by concatenating a matrix with a scaling transform.
GLKMatrix4 GLKMatrix4Scale ( GLKMatrix4 matrix, float sx, float sy, float sz );
Parameters
 matrix
A matrix.
 sx
The amount to scale the
x
component. sy
The amount to scale the
y
component. sz
The amount to scale the
z
component.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4ScaleWithVector3
Returns a new 4x4
matrix created by concatenating a matrix with a scaling transform defined by a vector.
GLKMatrix4 GLKMatrix4ScaleWithVector3 ( GLKMatrix4 matrix, GLKVector3 scaleVector );
Parameters
 matrix
A matrix.
 scaleVector
A vector whose
x
,y
andz
components are used to scale the matrix.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4ScaleWithVector4
Returns a new 4x4
matrix created by concatenating a matrix with a scaling transform defined by a vector.
GLKMatrix4 GLKMatrix4ScaleWithVector4 ( GLKMatrix4 matrix, GLKVector4 scaleVector );
Parameters
 matrix
A matrix.
 scaleVector
A vector whose
x
,y
andz
components are used to scale the matrix.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4SetColumn
Returns a new 4x4
matrix with one column replaced by a new vector.
GLKMatrix4 GLKMatrix4SetColumn ( GLKMatrix4 matrix, int column, GLKVector4 vector );
Parameters
 matrix
The source matrix.
 column
The index of the column to replace, which must be a number between
0
and3
, inclusive. vector
A vector holding the replacement component values.
Return Value
A new matrix.
Discussion
The first three components of column 3
provide the translation values tx
, ty
and tz
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4SetRow
Returns a new 4x4
matrix with one row replaced by a new vector.
GLKMatrix4 GLKMatrix4SetRow ( GLKMatrix4 matrix, int row, GLKVector4 vector );
Parameters
 matrix
The source matrix.
 row
The index of the row to replace, which must be a number between
0
and3
, inclusive. vector
A vector holding the replacement component values.
Return Value
A new matrix.
Discussion
The last component of rows 0
through 2
correspond to the translation values tx
, ty
, and tz
, respectively.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Subtract
Returns a new 4x4
matrix created by performing a componentwise subtraction of two matrices.
GLKMatrix4 GLKMatrix4Subtract ( GLKMatrix4 matrixLeft, GLKMatrix4 matrixRight );
Parameters
 matrixLeft
The starting matrix.
 matrixRight
The matrix to subtract.
Return Value
A new matrix whose components each represent the difference between the components found in the same positions of the two source matrices.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Translate
Returns a new 4x4
matrix created by concatenating a matrix with a translation transform.
GLKMatrix4 GLKMatrix4Translate ( GLKMatrix4 matrix, float tx, float ty, float tz );
Parameters
 matrix
A matrix.
 tx
The amount to translate the
x
component. ty
The amount to translate the
y
component. tz
The amount to translate the
z
component.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4TranslateWithVector3
Returns a new 4x4
matrix created by concatenating a matrix with a translation transform defined by a vector.
GLKMatrix4 GLKMatrix4TranslateWithVector3 ( GLKMatrix4 matrix, GLKVector3 translationVector );
Parameters
 matrix
A matrix.
 translationVector
A vector whose
x
,y
andz
components are used to translate the matrix.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4TranslateWithVector4
Returns a new 4x4
matrix created by concatenating a matrix with a translation transform defined by a vector.
GLKMatrix4 GLKMatrix4TranslateWithVector4 ( GLKMatrix4 matrix, GLKVector4 translationVector );
Parameters
 matrix
A matrix.
 translationVector
A vector whose
x
,y
andz
components are used to scale the matrix.
Return Value
A new matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
GLKMatrix4Transpose
Returns the transpose of a matrix.
GLKMatrix4 GLKMatrix4Transpose ( GLKMatrix4 matrix );
Parameters
 matrix
A
4x4
matrix.
Return Value
A new matrix that is the transpose of the original matrix.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMatrix4.h
Data Types
GLKMatrix4
A 4x4
matrix.
union _GLKMatrix4 { struct { float m00, m01, m02, m03; float m10, m11, m12, m13; float m20, m21, m22, m23; float m30, m31, m32, m33; }; float m[16]; } typedef union _GLKMatrix4 GLKMatrix4;
Fields
m00
The
[0,0]
element of the matrix.m01
The
[0,1]
element of the matrix.m02
The
[0,2]
element of the matrix.m03
The
[0,3]
element of the matrix.m10
The
[1,0]
element of the matrix.m11
The
[1,1]
element of the matrix.m12
The
[1,2]
element of the matrix.m13
The
[1,3]
element of the matrix.m20
The
[2,0]
element of the matrix.m21
The
[2,1]
element of the matrix.m22
The
[2,2]
element of the matrix.m23
The
[2,3]
element of the matrix.m30
The
[3,0]
element of the matrix. This element corresponds to the x coordinate’s translation value.m31
The
[3,1]
element of the matrix. This element corresponds to the y coordinate’s translation value.m32
The
[3,2]
element of the matrix. This element corresponds to the z coordinate’s translation value.m33
The
[2,3]
element of the matrix.m
A onedimensional array of the matrix’s element. The translation values (
tx
,ty
,tz
) are stored at indices12
,13
, and14
.
Availability
 Available in iOS 5.0 and later.
Declared In
GLKMathTypes.h
Constants
GLKMatrix4Identity
A 4x4
identity matrix.
extern const GLKMatrix4 GLKMatrix4Identity;
Constants
GLKMatrix4Identity
A
4x4
identity matrix.Available in iOS 5.0 and later.
Declared in
GLKMatrix4.h
.
Copyright © 2013 Apple Inc. All Rights Reserved. Terms of Use  Privacy Policy  Updated: 20130917