iOS Developer Library

Developer

GLKit Framework Reference GLKMatrixStack Reference

Options
Deployment Target:

On This Page
Language:

GLKMatrixStack Reference

Inherits From


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import GLKit

Objective-C

@import GLKit;

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

  • Allocates and returns a new matrix stack.

    Declaration

    Swift

    func GLKMatrixStackCreate(_ alloc: CFAllocator!) -> Unmanaged<GLKMatrixStack>!

    Objective-C

    GLKMatrixStackRef GLKMatrixStackCreate ( CFAllocatorRef alloc );

    Parameters

    alloc

    The allocator to use to allocate the matrix stack.

    Return Value

    A new matrix stack, or NULL if an error occurred.

    Discussion

    A matrix stack is a Core Foundation type. Ownership follows The Create Rule in Memory Management Programming Guide for Core Foundation.

    A matrix stack is initialized with a single identity matrix on the top of the stack.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in iOS 5.0 and later

  • Returns the Core Foundation type for a matrix stack.

    Declaration

    Swift

    func GLKMatrixStackGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID GLKMatrixStackGetTypeID ( void );

    Return Value

    A Core Foundation Type.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in iOS 5.0 and later

  • Removes the topmost entry from the stack.

    Declaration

    Swift

    func GLKMatrixStackPop(_ stack: GLKMatrixStack!)

    Objective-C

    void GLKMatrixStackPop ( GLKMatrixStackRef stack );

    Parameters

    stack

    A matrix stack.

    Discussion

    This function does nothing if the stack is already empty.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The number of matrices stored on the stack.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Return Value

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Return Value

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The top matrix.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The top matrix’s inverse.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack );

    Parameters

    stack

    A matrix stack.

    Return Value

    The top matrix’s inverse transpose.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, GLKMatrix4 matrix );

    Parameters

    stack

    A matrix stack.

    matrix

    The matrix whose contents should be loaded onto the stack.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, GLKMatrix4 matrix );

    Parameters

    stack

    A matrix stack.

    matrix

    The matrix multiplicand.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stackLeft, GLKMatrixStackRef stackRight );

    Parameters

    stackLeft

    A matrix stack to modify.

    stackRight

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, float radians );

    Parameters

    stack

    A matrix stack.

    radians

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, float radians );

    Parameters

    stack

    A matrix stack.

    radians

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, float radians );

    Parameters

    stack

    A matrix stack.

    radians

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, GLKVector3 scaleVector );

    Parameters

    stack

    A matrix stack.

    scaleVector

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, GLKVector4 scaleVector );

    Parameters

    stack

    A matrix stack.

    scaleVector

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, GLKVector3 translationVector );

    Parameters

    stack

    A matrix stack.

    translationVector

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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 stack, GLKVector4 translationVector );

    Parameters

    stack

    A matrix stack.

    translationVector

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

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    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