GLKTextureLoader
A utility class that simplifies loading OpenGL or OpenGL ES texture datas from a variety of image file formats.
Declaration
class GLKTextureLoaderOverview
The GLKTextureLoader class can load two-dimensional or cubemap textures in most image formats supported by the Image I/O framework. In iOS, it can also load textures compressed in the PVRTC format. It can load the data synchronously or asynchronously.
To load textures synchronously, make a context with the desired sharegroup the current context, and then call one or more of the class methods. The returned texture info object includes details about the loaded texture.
To load textures asynchronously, your initialization code allocates and initializes a new GLKTextureLoader object using the sharegroup object that should be the destination for new textures. Then, to load a texture, your app calls one of the texture loader’s instance methods, passing in a completion handler block to be called when the texture has been loaded.
The following OpenGL properties are set for a newly created, non-mipmapped texture:
GL_TEXTURE_MIN_FILTER:GL_LINEARGL_TEXTURE_MAG_FILTER:GL_LINEARGL_TEXTURE_WRAP_S:GL_CLAMP_TO_EDGEGL_TEXTURE_WRAP_T:GL_CLAMP_TO_EDGE
The following OpenGL properties are set for a newly created, mipmapped texture:
GL_TEXTURE_MIN_FILTER:GL_LINEAR_MIPMAP_LINEARGL_TEXTURE_MAG_FILTER:GL_LINEARGL_TEXTURE_WRAP_S:GL_CLAMP_TO_EDGEGL_TEXTURE_WRAP_T:GL_CLAMP_TO_EDGE
The GLKTextureLoader and GLKTextureInfo classes do not manage the OpenGL texture for you. Once the texture is returned to your app, you are responsible for it. This means that after your app is finished using an OpenGL texture, it must explicitly deallocate it by calling the glDeleteTextures function.
Topics
Initialization
Loading Textures from Files
Loading a Texture From a URL
Creating Textures from In-Memory Representations
Creating Textures from CGImages
Loading Cube Maps from Files
cubeMap(withContentsOfFile:options:)cubeMap(withContentsOfFile:options:queue:completionHandler:)cubeMap(withContentsOfFiles:options:)cubeMap(withContentsOfFiles:options:queue:completionHandler:)