iOS Developer Library

Developer

GLKit Framework Reference GLKMatrix4 Reference

Options
Deployment Target:

On This Page
Language:

GLKMatrix4 Reference

The GLKMatrix4 type defines a 4x4 floating-point 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

  • Returns a 4x4 matrix created from individual component values.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 transposed matrix created from individual component values.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix created from an array of component values.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4MakeWithArray ( float values[16] );

    Parameters

    float values[16]

    An array of component values, in column-major 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 transposed matrix created from an array of component values.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4MakeWithArrayAndTranspose ( float values[16] );

    Parameters

    float values[16]

    An array of component values, in column-major 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix created from four column vectors.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix created from four row vectors.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a rotation around an arbitrary vector.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a rotation around the positive x-axis.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4MakeXRotation ( float radians );

    Parameters

    radians

    The angle of the rotation (a positive angle is counterclockwise).

    Return Value

    A new rotation matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a rotation around the positive y-axis.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4MakeYRotation ( float radians );

    Parameters

    radians

    The angle of the rotation (a positive angle is counterclockwise).

    Return Value

    A new rotation matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a rotation around the positive z-axis.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4MakeZRotation ( float radians );

    Parameters

    radians

    The angle of the rotation (a positive angle is counterclockwise).

    Return Value

    A new rotation matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a rotation based on a quaternion.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4MakeWithQuaternion ( GLKQuaternion quaternion );

    Parameters

    quaternion

    The quaternion.

    Return Value

    A new matrix that provides an equivalent rotation to that stored in the quaternion.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a scaling transformation.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that performs a translation.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 matrix that transforms world coordinates to eye coordinates.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 orthographic projection matrix.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 perspective projection matrix.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a 4x4 perspective projection matrix.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns the upper-left 2x2 section of a 4x4 matrix.

    Declaration

    Objective-C

    GLKMatrix2 GLKMatrix4GetMatrix2 ( GLKMatrix4 matrix );

    Parameters

    matrix

    A 4x4 matrix.

    Return Value

    A new 2x2 matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns the upper-left 3x3 section of a 4x4 matrix.

    Declaration

    Objective-C

    GLKMatrix3 GLKMatrix4GetMatrix3 ( GLKMatrix4 matrix );

    Parameters

    matrix

    A 4x4 matrix.

    Return Value

    A new 3x3 matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Retrieves a column from a 4x4 matrix.

    Declaration

    Objective-C

    GLKVector4 GLKMatrix4GetColumn ( GLKMatrix4 matrix, int column );

    Parameters

    matrix

    A 4x4 matrix.

    column

    The column index, which must be a number between 0 and 3, 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Retrieves a row from a 4x4 matrix.

    Declaration

    Objective-C

    GLKVector4 GLKMatrix4GetRow ( GLKMatrix4 matrix, int row );

    Parameters

    matrix

    A 4x4 matrix.

    row

    The row index, which must be a number between 0 and 3, 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix with one column replaced by a new vector.

    Declaration

    Objective-C

    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 and 3, 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix with one row replaced by a new vector.

    Declaration

    Objective-C

    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 and 3, 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns the inverse of a matrix.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4Invert ( GLKMatrix4 matrix, bool *isInvertible );

    Parameters

    matrix

    A 4x4 matrix.

    isInvertible

    On return, this holds YEStrue if the matrix was inverted or NOfalse if the matrix is not invertible.

    Return Value

    If isInvertible was set to YEStrue, this holds an inverted matrix. Otherwise, the identity matrix is returned.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns the transpose of a matrix.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4Transpose ( GLKMatrix4 matrix );

    Parameters

    matrix

    A 4x4 matrix.

    Return Value

    A new matrix that is the transpose of the original matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns the inverse transpose of a matrix.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4InvertAndTranspose ( GLKMatrix4 matrix, bool *isInvertible );

    Parameters

    matrix

    A 4x4 matrix.

    isInvertible

    On return, this holds YEStrue if the matrix was inverted or NOfalse if the matrix is not invertible.

    Return Value

    If isInvertible was set to YEStrue, this holds an inverted and transposed matrix. Otherwise, the identity matrix is returned.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns the product of two matrices.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a rotation around a vector.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a rotation around the x-axis.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a rotation around the y-axis.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a rotation around the z-axis.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform defined by a vector.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4ScaleWithVector3 ( GLKMatrix4 matrix, GLKVector3 scaleVector );

    Parameters

    matrix

    A matrix.

    scaleVector

    A vector whose x, y and z components are used to scale the matrix.

    Return Value

    A new matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a scaling transform defined by a vector.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4ScaleWithVector4 ( GLKMatrix4 matrix, GLKVector4 scaleVector );

    Parameters

    matrix

    A matrix.

    scaleVector

    A vector whose x, y and z components are used to scale the matrix.

    Return Value

    A new matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a translation transform.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a translation transform defined by a vector.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4TranslateWithVector3 ( GLKMatrix4 matrix, GLKVector3 translationVector );

    Parameters

    matrix

    A matrix.

    translationVector

    A vector whose x, y and z components are used to translate the matrix.

    Return Value

    A new matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by concatenating a matrix with a translation transform defined by a vector.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4TranslateWithVector4 ( GLKMatrix4 matrix, GLKVector4 translationVector );

    Parameters

    matrix

    A matrix.

    translationVector

    A vector whose x, y and z components are used to scale the matrix.

    Return Value

    A new matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by performing a component-wise addition of two matrices.

    Declaration

    Objective-C

    GLKMatrix4 GLKMatrix4Add ( 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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Returns a new 4x4 matrix created by performing a component-wise subtraction of two matrices.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by a 3-component vector.

    Declaration

    Objective-C

    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 4-component vector with a w-component of 0.0.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by an array of 3-component vectors.

    Declaration

    Objective-C

    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 4-component vectors with a w-component of 0.0.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by a 3-component vector, applying translation.

    Declaration

    Objective-C

    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 4-component vector with a w-component of 1.0.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by an array of 3-component vectors, applying translation.

    Declaration

    Objective-C

    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 4-component vectors with a w-component of 1.0.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by a 4-component vector.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by an array of 4-component vectors.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by a position vector to create a vector in homogenous coordinates, then projects the result to a 3-component vector.

    Declaration

    Objective-C

    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

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

  • Multiplies a 4x4 matrix by an array of 3-component vectors. Each result is projected back to 3-component vector.

    Declaration

    Objective-C

    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.

    Import Statement

    Objective-C

    @import GLKit;

    Availability

    Available in iOS 5.0 and later.

Data Types

  • A 4x4 matrix.

    Declaration

    Objective-C

    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 one-dimensional array of the matrix’s element. The translation values (tx,ty, tz) are stored at indices 12,13, and 14.

    Availability

    Available in iOS 5.0 and later.

Constants

  • A 4x4 identity matrix.

    Declaration

    Objective-C

    extern const GLKMatrix4 GLKMatrix4Identity;

    Constants

    • GLKMatrix4Identity

      GLKMatrix4Identity

      A 4x4 identity matrix.

      Available in iOS 5.0 and later.