iOS Developer Library — Prerelease

Developer

GLKit Framework Reference GLKMatrixStack Reference

Options
Deployment Target:

On This Page
Language:

GLKMatrixStack Reference

The GLKMatrixStack type defines an opaque Core Foundation type that provides a stack of 4x4 matrices. A stack of matrices allows your application to push a new matrix on the top of the stack, manipulate it, use it to render geometry, and then pop it off the stack to restore the previous matrix. This behavior is useful when implementing hierarchical animation systems.

Functions

  • Removes the topmost entry from the stack.

    Declaration

    Swift

    func GLKMatrixStackPop(_ stack: GLKMatrixStack)

    Objective-C

    void GLKMatrixStackPop ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Discussion

    This function does nothing if the stack is already empty.

    Availability

    Available in iOS 5.0 and later.

  • Push a copy of the topmost matrix onto the top of the stack.

    Declaration

    Swift

    func GLKMatrixStackPush(_ stack: GLKMatrixStack)

    Objective-C

    void GLKMatrixStackPush ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Availability

    Available in iOS 5.0 and later.

  • Returns the number of matrices present on the matrix stack.

    Declaration

    Swift

    func GLKMatrixStackSize(_ stack: GLKMatrixStack) -> Int32

    Objective-C

    int GLKMatrixStackSize ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The number of matrices stored on the stack.

    Availability

    Available in iOS 5.0 and later.

  • Returns the top left 2x2 corner of the top matrix.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix2(_ stack: GLKMatrixStack) -> GLKMatrix2

    Objective-C

    GLKMatrix2 GLKMatrixStackGetMatrix2 ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    A 2x2 matrix created by taking the top left corner of the top matrix.

    Availability

    Available in iOS 5.0 and later.

  • Returns the top left 3x3 corner of the top matrix.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix3(_ stack: GLKMatrixStack) -> GLKMatrix3

    Objective-C

    GLKMatrix3 GLKMatrixStackGetMatrix3 ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    A 3x3 matrix created by taking the top left corner of the top matrix.

    Availability

    Available in iOS 5.0 and later.

  • Fetches the top left 3x3 corner of the top matrix and returns its inverse.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix3Inverse(_ stack: GLKMatrixStack) -> GLKMatrix3

    Objective-C

    GLKMatrix3 GLKMatrixStackGetMatrix3Inverse ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    A 3x3 matrix created by taking the top left corner of the top matrix and returning its inverse.

    Availability

    Available in iOS 5.0 and later.

  • Fetches the top left 3x3 corner of the top matrix and returns its inverse transpose.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix3InverseTranspose(_ stack: GLKMatrixStack) -> GLKMatrix3

    Objective-C

    GLKMatrix3 GLKMatrixStackGetMatrix3InverseTranspose ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    A 3x3 matrix created by taking the top left corner of the top matrix and returning its inverse transpose.

    Availability

    Available in iOS 5.0 and later.

  • Returns a copy of the top matrix on the stack.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix4(_ stack: GLKMatrixStack) -> GLKMatrix4

    Objective-C

    GLKMatrix4 GLKMatrixStackGetMatrix4 ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The top matrix.

    Availability

    Available in iOS 5.0 and later.

  • Returns the inverse of the top matrix.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix4Inverse(_ stack: GLKMatrixStack) -> GLKMatrix4

    Objective-C

    GLKMatrix4 GLKMatrixStackGetMatrix4Inverse ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The top matrix’s inverse.

    Availability

    Available in iOS 5.0 and later.

  • Returns the inverse transpose of the top matrix.

    Declaration

    Swift

    func GLKMatrixStackGetMatrix4InverseTranspose(_ stack: GLKMatrixStack) -> GLKMatrix4

    Objective-C

    GLKMatrix4 GLKMatrixStackGetMatrix4InverseTranspose ( GLKMatrixStackRef _Nonnull stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The top matrix’s inverse transpose.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a new matrix.

    Declaration

    Swift

    func GLKMatrixStackLoadMatrix4(_ stack: GLKMatrixStack, _ matrix: GLKMatrix4)

    Objective-C

    void GLKMatrixStackLoadMatrix4 ( GLKMatrixStackRef _Nonnull stack, GLKMatrix4 matrix );

    Parameters

    stack

    A matrix stack.

    matrix

    The matrix whose contents should be loaded onto the stack.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by multiplying the contents of the top matrix by another matrix.

    Declaration

    Swift

    func GLKMatrixStackMultiplyMatrix4(_ stack: GLKMatrixStack, _ matrix: GLKMatrix4)

    Objective-C

    void GLKMatrixStackMultiplyMatrix4 ( GLKMatrixStackRef _Nonnull stack, GLKMatrix4 matrix );

    Parameters

    stack

    A matrix stack.

    matrix

    The matrix multiplicand.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by multiplying the contents of the top matrix by the top matrix of another matrix stack.

    Declaration

    Swift

    func GLKMatrixStackMultiplyMatrixStack(_ stackLeft: GLKMatrixStack, _ stackRight: GLKMatrixStack)

    Objective-C

    void GLKMatrixStackMultiplyMatrixStack ( GLKMatrixStackRef _Nonnull stackLeft, GLKMatrixStackRef _Nonnull stackRight );

    Parameters

    stackLeft

    A matrix stack to modify.

    stackRight

    A matrix stack whose top matrix is to be used as the multiplicand.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a rotation around an arbitrary axis.

    Declaration

    Swift

    func GLKMatrixStackRotate(_ stack: GLKMatrixStack, _ radians: Float, _ x: Float, _ y: Float, _ z: Float)

    Objective-C

    void GLKMatrixStackRotate ( GLKMatrixStackRef _Nonnull stack, float radians, float x, float y, float z );

    Parameters

    stack

    A matrix stack.

    radians

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

    x

    The x coordinate of the rotation axis.

    y

    The y coordinate of the rotation axis.

    z

    The z coordinate of the rotation axis.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a rotation around an arbitrary axis.

    Declaration

    Swift

    func GLKMatrixStackRotateWithVector3(_ stack: GLKMatrixStack, _ radians: Float, _ axisVector: GLKVector3)

    Objective-C

    void GLKMatrixStackRotateWithVector3 ( GLKMatrixStackRef _Nonnull stack, float radians, GLKVector3 axisVector );

    Parameters

    stack

    A matrix stack.

    radians

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

    axisVector

    A vector whose x,y and z coordinates are used as the axis of rotation.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a rotation around an arbitrary axis.

    Declaration

    Swift

    func GLKMatrixStackRotateWithVector4(_ stack: GLKMatrixStack, _ radians: Float, _ axisVector: GLKVector4)

    Objective-C

    void GLKMatrixStackRotateWithVector4 ( GLKMatrixStackRef _Nonnull stack, float radians, GLKVector4 axisVector );

    Parameters

    stack

    A matrix stack.

    radians

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

    axisVector

    A vector whose x,y and z coordinates are used as the axis of rotation.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a rotation around the positive-x axis.

    Declaration

    Swift

    func GLKMatrixStackRotateX(_ stack: GLKMatrixStack, _ radians: Float)

    Objective-C

    void GLKMatrixStackRotateX ( GLKMatrixStackRef _Nonnull stack, float radians );

    Parameters

    stack

    A matrix stack.

    radians

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

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a rotation around the positive-y axis.

    Declaration

    Swift

    func GLKMatrixStackRotateY(_ stack: GLKMatrixStack, _ radians: Float)

    Objective-C

    void GLKMatrixStackRotateY ( GLKMatrixStackRef _Nonnull stack, float radians );

    Parameters

    stack

    A matrix stack.

    radians

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

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a rotation around the positive-z axis.

    Declaration

    Swift

    func GLKMatrixStackRotateZ(_ stack: GLKMatrixStack, _ radians: Float)

    Objective-C

    void GLKMatrixStackRotateZ ( GLKMatrixStackRef _Nonnull stack, float radians );

    Parameters

    stack

    A matrix stack.

    radians

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

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by scaling the contents of the top matrix.

    Declaration

    Swift

    func GLKMatrixStackScale(_ stack: GLKMatrixStack, _ sx: Float, _ sy: Float, _ sz: Float)

    Objective-C

    void GLKMatrixStackScale ( GLKMatrixStackRef _Nonnull stack, float sx, float sy, float sz );

    Parameters

    stack

    A matrix stack.

    sx

    The scaling factor used to modify the x components.

    sy

    The scaling factor used to modify the y components.

    sz

    The scaling factor used to modify the z components.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a scaling operation.

    Declaration

    Swift

    func GLKMatrixStackScaleWithVector3(_ stack: GLKMatrixStack, _ scaleVector: GLKVector3)

    Objective-C

    void GLKMatrixStackScaleWithVector3 ( GLKMatrixStackRef _Nonnull stack, GLKVector3 scaleVector );

    Parameters

    stack

    A matrix stack.

    scaleVector

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

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a scaling operation defined by a vector.

    Declaration

    Swift

    func GLKMatrixStackScaleWithVector4(_ stack: GLKMatrixStack, _ scaleVector: GLKVector4)

    Objective-C

    void GLKMatrixStackScaleWithVector4 ( GLKMatrixStackRef _Nonnull stack, GLKVector4 scaleVector );

    Parameters

    stack

    A matrix stack.

    scaleVector

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

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a translation operation.

    Declaration

    Swift

    func GLKMatrixStackTranslate(_ stack: GLKMatrixStack, _ tx: Float, _ ty: Float, _ tz: Float)

    Objective-C

    void GLKMatrixStackTranslate ( GLKMatrixStackRef _Nonnull stack, float tx, float ty, float tz );

    Parameters

    stack

    A matrix stack.

    tx

    The amount to translate the position along the x-axis.

    ty

    The amount to translate the position along the y-axis.

    tz

    The amount to translate the position along the z-axis.

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a translation defined by a vector.

    Declaration

    Swift

    func GLKMatrixStackTranslateWithVector3(_ stack: GLKMatrixStack, _ translationVector: GLKVector3)

    Objective-C

    void GLKMatrixStackTranslateWithVector3 ( GLKMatrixStackRef _Nonnull stack, GLKVector3 translationVector );

    Parameters

    stack

    A matrix stack.

    translationVector

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

    Availability

    Available in iOS 5.0 and later.

  • Replaces the contents of the top matrix with a matrix calculated by composing the top matrix with a translation defined by a vector.

    Declaration

    Swift

    func GLKMatrixStackTranslateWithVector4(_ stack: GLKMatrixStack, _ translationVector: GLKVector4)

    Objective-C

    void GLKMatrixStackTranslateWithVector4 ( GLKMatrixStackRef _Nonnull stack, GLKVector4 translationVector );

    Parameters

    stack

    A matrix stack.

    translationVector

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

    Availability

    Available in iOS 5.0 and later.

Data Types

  • An opaque type that represents a stack of 4x4 matrices.

    Declaration

    Swift

    typealias GLKMatrixStackRef = GLKMatrixStack

    Objective-C

    typedef struct _GLKMatrixStack *GLKMatrixStackRef;

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in iOS 5.0 and later.