Package apple.glkit

Class GLKSkyboxEffect

  • All Implemented Interfaces:
    GLKNamedEffect, NSObject

    public class GLKSkyboxEffect
    extends NSObject
    implements GLKNamedEffect
    GLKSkyboxEffect GLKSkyboxEffect implements common skybox functionality as is used by many of todays games and simulations. A skybox is a textured cube that encloses the boundaries of the object space of a 3D graphics application or game. It provides a visual horizon in all camera directions within 3D object space. GLKSkyboxEffect requires at least an OpenGL ES 2.0 context on iOS and an OpenGL Core Profile context on OS X. This context must be initialized and made current prior to creating or initializing GLKSkyboxEffect instances. No OpenGL context state settings are modified when a GLKSkyboxEffect instance is created or its properties set. When -[GLKSkyboxEffect prepareToDraw] is called it modifies the following state: GL_CURRENT_PROGRAM GL_TEXTURE_BINDING_CUBE_MAP GL_VERTEX_ARRAY_BINDING_OES GL_ARRAY_BUFFER_BINDING GL_VERTEX_ATTRIB_ARRAY_ENABLED (GLKVertexAttribPosition) For performance reasons GLKSkyboxEffect does not restore any of these state settings. It is up to the client application to save/restore/set these state elements as they choose. A cube mapped texture name must be provided to GLKSkyboxEffect to provide it texture data for the 6 faces of the skybox cube. Care must be taken when preparing the cubemap texture to prevent seams from appearing at the interfaces between adjacent faces. Unlike other named effects, GLKSkyboxEffect provides a -draw method and requires no ancillary vertex attribute setup because the class maintains the simple, unambiguous geometry data required to draw the skybox internally. The following (4) steps are required to use GLKSkyboxEffect: (1) Allocate and initialize an instance of GLKSkyboxEffect skybox = [[GLKSkyboxEffect alloc] init]; (2) Create a cube map texture for the skybox glGenTextures(1, &cubeMapName); glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapName); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); GLenum cubeMapBase = GL_TEXTURE_CUBE_MAP_POSITIVE_X; for(face = 0; face < 6; face++) glTexImage2D(cubeMapBase + face, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, faceData[face]); (3) Configure the skybox effect transform, location, size, and texture properties skybox.center = center; skybox.xSize = xSize; skybox.ySize = ySize; skybox.zSize = zSize; skybox.textureCubeMap = cubeMapName; // created in step (2) above (4) For each frame drawn: Update properties that change per frame. Synchronize the changed effect state by calling -[GLKSkyboxEffect prepareToDraw]. Draw the the skybox. skybox.transform.modelviewMatrix = modelviewMatrix; [skybox prepareToDraw]; [skybox draw];
    • Constructor Detail

      • GLKSkyboxEffect

        protected GLKSkyboxEffect​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • center

        public GLKVector3 center()
        { 0.0, 0.0, 0.0 }
      • draw

        public void draw()
        Draw skybox
      • label

        public java.lang.String label()
        nil
      • setCenter

        public void setCenter​(GLKVector3 value)
        { 0.0, 0.0, 0.0 }
      • setLabel

        public void setLabel​(java.lang.String value)
        nil
      • setXSize

        public void setXSize​(float value)
        1.0, 1.0, 1.0
      • setYSize

        public void setYSize​(float value)
        1.0, 1.0, 1.0
      • setZSize

        public void setZSize​(float value)
        1.0, 1.0, 1.0
      • xSize

        public float xSize()
        1.0, 1.0, 1.0
      • ySize

        public float ySize()
        1.0, 1.0, 1.0
      • zSize

        public float zSize()
        1.0, 1.0, 1.0