Mac Developer Library

Developer

GLKit Framework Reference GLKReflectionMapEffect Class Reference

Options
Deployment Target:

On This Page
Language:

GLKReflectionMapEffect

Inheritance


Conforms To


Import Statement


Swift

import GLKit

Objective-C

@import GLKit;

Availability


Available in OS X v10.8 and later.

The GLKReflectionMapEffect class extends the base effect to add an additional texturing stage that performs reflection mapping.

In addition to any of the properties provided by the GLKBaseEffect class, your application must also configure the properties on the reflection map. The default value of the textureOrder property provided by the base effect is modified to include the reflection map as a final texturing stage; your application can modify the value of that property to change the order in which texturing occurs.

The reflection map effect is calculated in accordance to section 2.11.4 of the OpenGL 2.1 specification GL_REFLECTION_MAP glTexGen() mode. It requires a cube map texture to define the enclosing envelope from which to reflection map the scene.

  • Prepares an effect for rendering.

    Declaration

    Swift

    func prepareToDraw()

    Objective-C

    - (void)prepareToDraw

    Discussion

    An effect must be prepared after it is configured and again when your application wants to use the effect to render any primitives. When your application prepares an effect, some OpenGL state is altered to allow the effect to operate:

    • The GL_CURRENT_PROGRAM state is always changed to point to the shader provided by the effect object.

    • When texturing is enabled, the GL_TEXTURE_BINDING_2D state and GL_TEXTURE_BINDING_CUBE_MAP state may also change.

    If your application requires the previous state to be saved before the effect alters them, it must explicitly save and restore the values.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in OS X v10.8 and later.

  • The texture map to apply in the reflection stage. (read-only)

    Declaration

    Swift

    var textureCubeMap: GLKEffectPropertyTexture! { get }

    Objective-C

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

    • reflectionMapObject.textureCubeMap.glName = texture_name;

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in OS X v10.8 and later.

  • matrix matrix Property

    The reflection matrix to apply to the normals of the submitted vertices.

    Declaration

    Swift

    var matrix: GLKMatrix3

    Objective-C

    @property(nonatomic, assign) GLKMatrix3 matrix

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in OS X v10.8 and later.