public class GLKSkyboxEffect extends NSObject implements GLKNamedEffect
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];
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
GLKSkyboxEffect(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
static GLKSkyboxEffect |
alloc() |
static GLKSkyboxEffect |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
GLKVector3 |
center()
{ 0.0, 0.0, 0.0 }
|
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
void |
draw()
Draw skybox
|
static long |
hash_static() |
GLKSkyboxEffect |
init() |
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
java.lang.String |
label()
nil
|
static GLKSkyboxEffect |
new_objc() |
void |
prepareToDraw() |
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
void |
setCenter(GLKVector3 value)
{ 0.0, 0.0, 0.0 }
|
void |
setLabel(java.lang.String value)
nil
|
static void |
setVersion_static(long aVersion) |
void |
setXSize(float value)
1.0, 1.0, 1.0
|
void |
setYSize(float value)
1.0, 1.0, 1.0
|
void |
setZSize(float value)
1.0, 1.0, 1.0
|
static org.moe.natj.objc.Class |
superclass_static() |
GLKEffectPropertyTexture |
textureCubeMap()
name == 0, target == GL_TEXTURE_CUBE_MAP
|
GLKEffectPropertyTransform |
transform()
Identity for all matrices
|
static long |
version_static() |
float |
xSize()
1.0, 1.0, 1.0
|
float |
ySize()
1.0, 1.0, 1.0
|
float |
zSize()
1.0, 1.0, 1.0
|
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKeypublic static boolean accessInstanceVariablesDirectly()
public static GLKSkyboxEffect alloc()
public static GLKSkyboxEffect allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public static long hash_static()
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public static GLKSkyboxEffect new_objc()
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public GLKVector3 center()
public void draw()
public GLKSkyboxEffect init()
public java.lang.String label()
public void prepareToDraw()
prepareToDraw in interface GLKNamedEffectpublic void setCenter(GLKVector3 value)
public void setLabel(java.lang.String value)
public void setXSize(float value)
public void setYSize(float value)
public void setZSize(float value)
public GLKEffectPropertyTexture textureCubeMap()
public GLKEffectPropertyTransform transform()
public float xSize()
public float ySize()
public float zSize()