GLKSkyboxEffect Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/GLKit.framework
Availability
Available in OS X v10.8 and later.
Declared in
GLKSkyboxEffect.h

Overview

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.

Tasks

Naming the Effect

Preparing the Effect for Rendering

Drawing the Skybox

Configuring the Skybox

Setting the Skybox Transform

Properties

center

The center of the skybox.

@property(nonatomic, assign) GLKVector3 center
Discussion

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

Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

label

A string used to name your effect.

@property(nonatomic, retain) NSString *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 OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

textureCubeMap

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

@property(nonatomic, readonly) GLKEffectPropertyTexture *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.

skyboxEffect.textureCubeMap.glName = texture_name;
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

transform

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

@property(nonatomic, readonly) GLKEffectPropertyTransform *transform
Discussion

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

Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

xSize

The width of the skybox.

@property(nonatomic, assign) GLfloat xSize
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

ySize

The height of the skybox.

@property(nonatomic, assign) GLfloat ySize
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

zSize

The depth of the skybox.

@property(nonatomic, assign) GLfloat zSize
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

Instance Methods

draw

Draws the skybox.

- (void)draw
Availability
  • Available in OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h

prepareToDraw

Prepares an effect for rendering.

- (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 OS X v10.8 and later.
Declared In
GLKSkyboxEffect.h