MonoTouch.GLKit.GLKTextureLoader Class
Loads Image and cube maps into OpenGL textures.

See Also: GLKTextureLoader Members

Syntax

[MonoTouch.Foundation.Register("GLKTextureLoader", true)]
[MonoTouch.ObjCRuntime.Availability(Introduced=MonoTouch.ObjCRuntime.Platform.Mac_10_0 | MonoTouch.ObjCRuntime.Platform.Mac_10_1 | MonoTouch.ObjCRuntime.Platform.Mac_10_2 | MonoTouch.ObjCRuntime.Platform.Mac_10_3 | MonoTouch.ObjCRuntime.Platform.Mac_10_4 | MonoTouch.ObjCRuntime.Platform.Mac_10_5 | MonoTouch.ObjCRuntime.Platform.Mac_10_6 | MonoTouch.ObjCRuntime.Platform.Mac_10_7 | MonoTouch.ObjCRuntime.Platform.Mac_10_8 | MonoTouch.ObjCRuntime.Platform.Mac_10_9 | MonoTouch.ObjCRuntime.Platform.Mac_10_10 | MonoTouch.ObjCRuntime.Platform.Mac_Version | MonoTouch.ObjCRuntime.Platform.Mac_Arch64 | MonoTouch.ObjCRuntime.Platform.Mac_Arch)]
[MonoTouch.ObjCRuntime.Availability(Introduced=MonoTouch.ObjCRuntime.Platform.iOS_5_0)]
public class GLKTextureLoader : MonoTouch.Foundation.NSObject

Remarks

GLTextureLoader simplifies the process of loading textures and cube maps by providing a high-level API that can load images on a variety of graphic file formats (PNG, JPEG, TIFF and other formats supported by MonoTouch.ImageIO. The data can be loaded both synchronously and asynchrously from MonoTOuch.CoreGraphics.CGImage objects, in-memory binary data, files and arbitrary MonoTouch.Foundation.NSUrl locations.

You can control how textures are loaded by configuring the MonoTouch.GLKit.GLKTextureOperations object. You can configure whether the texture will be premultiplied by their alpha channel or not, whether mipmaps should be created from the source image when the texture is loaded and whether the image should be flipped when it is loaded.

To use the texture loader, make an MonoTouch.OpenGLES.EAGLContext current, use one of the loading methods in this class and use the values in the returned MonoTouch.GLKit.GLKTextureInfo which contains the OpenGL object name (an uint), properties such as width, heigh, alpha, origin and mipmapping.

To use the texture loaded asynchrously, create the context using the MonoTouch.OpenGLES.EAGLContext's sharegroup. Then you call one of the

c# Example

//
// if myQueue is null, it dispatches into the main queue.
void AsyncLoad (EAGLContext context, DispatchQueue myQueue)
{
    var shareGroup = context.ShareGroup;
    var loader = new GLTextureLoader (shareGroup);
    var textureOperations = new GLKTextureOperations () {
        ApplyPremultiplication = true,
        GenerateMipmaps = true
    }

    loader.BeginTextureLoad ("file.png", textureOperations, myQueue, TextureLoadedCallback);
}

// 
// Called on the specified queue.
//
void TextureLoadedCallback (GLKTextureInfo textureInfo, NSError error)
{
    // Use texture info here.
}

Related content

Requirements

Namespace: MonoTouch.GLKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0