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

See Also: GLKTextureLoader Members

Syntax

[Foundation.Register("GLKTextureLoader", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.Mac_10_0 | ObjCRuntime.Platform.Mac_10_1 | ObjCRuntime.Platform.Mac_10_2 | ObjCRuntime.Platform.Mac_10_3 | ObjCRuntime.Platform.Mac_10_4 | ObjCRuntime.Platform.Mac_10_5 | ObjCRuntime.Platform.Mac_10_6 | ObjCRuntime.Platform.Mac_10_7 | ObjCRuntime.Platform.Mac_10_8 | ObjCRuntime.Platform.Mac_10_9 | ObjCRuntime.Platform.Mac_10_10 | ObjCRuntime.Platform.Mac_Version | ObjCRuntime.Platform.Mac_Arch64 | ObjCRuntime.Platform.Mac_Arch)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_5_0)]
public class GLKTextureLoader : 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 ImageIO. The data can be loaded both synchronously and asynchrously from MonoTOuch.CoreGraphics.CGImage objects, in-memory binary data, files and arbitrary Foundation.NSUrl locations.

You can control how textures are loaded by configuring the 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 OpenGLES.EAGLContext current, use one of the loading methods in this class and use the values in the returned 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 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: GLKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0