iOS Developer Library — Prerelease

Developer

GLKit Framework Reference GLKSkyboxEffect Class Reference

Options
Deployment Target:

On This Page
Language:

GLKSkyboxEffect

The GLKSkyboxEffect provides a standard skybox effect for your application. Unlike the GLKBaseEffect class, the skybox does not require your application to configure and submit vertex data. Instead, it creates its own vertex data based on the configuration data you supply.

At initialization time, your application first creates a compatible context and makes it current. Then, it creates new skybox effect, configures its properties, and calls its prepareToDraw method. Binding the effect causes a shader to be compiled and bound to the current context.

At rendering time, your application calls the effect’s prepareToDraw method to prepare the effect and then calls its draw method to draw the sky box.

  • A string used to name your effect.

    Declaration

    Swift

    var label: String?

    Objective-C

    @property(nonatomic, copy) NSString * _Nullable label

    Discussion

    The name of the effect isn’t used directly by GLKit, but is printed when, for example, you log the object to the console via the NSLog function.

    Availability

    Available in iOS 5.0 and later.

  • Prepares an effect for rendering.

    Declaration

    Swift

    func prepareToDraw()

    Objective-C

    - (void)prepareToDraw

    Discussion

    When the skybox shader is bound, the following state variables are altered:

    • GL_CURRENT_PROGRAM

    • GL_TEXTURE_BINDING_CUBE_MAP

    • GL_VERTEX_ARRAY_BINDING_OES

    • GL_VERTEX_ATTRIB_ARRAY_ENABLED

    Your application is responsible for saving and restoring these variables, if necessary for it to execute correctly.

    Availability

    Available in iOS 5.0 and later.

  • Draws the skybox.

    Declaration

    Swift

    func draw()

    Objective-C

    - (void)draw

    Availability

    Available in iOS 5.0 and later.

  • The texture to apply to the skybox. (read-only)

    Declaration

    Swift

    var textureCubeMap: GLKEffectPropertyTexture { get }

    Objective-C

    @property(nonatomic, readonly) GLKEffectPropertyTexture * _Nonnull textureCubeMap

    Discussion

    Your application should create a complete texture cube map in its initialization code. Then, assign the name of this texture to the textureCubeMap property of the skybox object.

    1. skyboxEffect.textureCubeMap.glName = texture_name;

    Availability

    Available in iOS 5.0 and later.

  • The center of the skybox.

    Declaration

    Swift

    var center: GLKVector3

    Objective-C

    @property(nonatomic, assign) GLKVector3 center

    Discussion

    The property holds the [x,y,z] coordinates of the center of the skybox.

    Availability

    Available in iOS 5.0 and later.

  • The width of the skybox.

    Declaration

    Swift

    var xSize: GLfloat

    Objective-C

    @property(nonatomic, assign) GLfloat xSize

    Availability

    Available in iOS 5.0 and later.

  • The height of the skybox.

    Declaration

    Swift

    var ySize: GLfloat

    Objective-C

    @property(nonatomic, assign) GLfloat ySize

    Availability

    Available in iOS 5.0 and later.

  • The depth of the skybox.

    Declaration

    Swift

    var zSize: GLfloat

    Objective-C

    @property(nonatomic, assign) GLfloat zSize

    Availability

    Available in iOS 5.0 and later.

  • The transform applied before drawing the skybox. (read-only)

    Declaration

    Swift

    var transform: GLKEffectPropertyTransform { get }

    Objective-C

    @property(nonatomic, readonly) GLKEffectPropertyTransform * _Nonnull transform

    Discussion

    Your application uses this transform to set the position and orientation of the camera.

    Availability

    Available in iOS 5.0 and later.