Inherits from NSObject
Conforms to NGLCopying
Declared in NGLTexture.h

Overview

The NinevehGL texture class.

The NGLTexture holds all necessary information to construct a texture map with any OpenGL version. The image can be extracted from a file path, using the NinevehGL’s Path API, or from an UIImage instance.

If both are set, the image for texture will be extracted preferentially from the UIImage instance.

NinevehGL accepts non-POT sizes, that means, non Power of Two. You can use any texture size you want, like 2000 x 1000, 754 x 421 or any other. However, as OpenGL just accept POT sizes, your image will be stretched to the nearest POT value. For example, 754 x 421 will become 1024 x 512. The maximum size is 1024 for commum displays or 2048 for retina displays.

All the texture files must follow these rules:

  • 8 bits per channel.

The supported image file formats and extensions are:

  • Tagged Image File Format (.tiff, .tif);
  • Joint Photographic Experts Group (.jpg, .jpeg);
  • Graphic Interchange Format (.gif);
  • Portable Network Graphic (.png);
  • Windows Bitmap Format (.bmp, .bmpf);
  • Windows Icon Format (.ico);
  • Windows Cursor (.cur);
  • XWindow bitmap (.xbm).

Tasks

  •   filePath

    The image file path. The paths in NinevehGL is managed by NinevehGL’s Path API. The type of the image file should be supported by one of NinevehGL parsers.

    property
  •   image

    An UIImage instance. The image from texture will be extract, preferentially, from this UIImage instance.

    property
  •   type

    The texture type.

    property
  •   quality

    The final texture quality.

    property
  •   repeat

    The repeat filter which will be applied to the texture.

    property
  •   optimize

    The situations in which this texture can be optimized.

    property
  • – init2DWithFile:

    Initializes a new instance of NGLTexture.

  • – init2DWithImage:

    Initializes a new instance of NGLTexture.

  • + texture2DWithFile:

    Returns an autoreleased instance of NGLTexture.

  • + texture2DWithImage:

    Returns an autoreleased instance of NGLTexture.

Properties

filePath

The image file path. The paths in NinevehGL is managed by NinevehGL’s Path API. The type of the image file should be supported by one of NinevehGL parsers.

@property (nonatomic, copy) NSString *filePath

Discussion

The image file path. The paths in NinevehGL is managed by NinevehGL’s Path API. The type of the image file should be supported by one of NinevehGL parsers.

Declared In

NGLTexture.h

image

An UIImage instance. The image from texture will be extract, preferentially, from this UIImage instance.

@property (nonatomic, retain) UIImage *image

Discussion

An UIImage instance. The image from texture will be extract, preferentially, from this UIImage instance.

Declared In

NGLTexture.h

optimize

The situations in which this texture can be optimized.

@property (nonatomic) NGLTextureOptimize optimize

Discussion

The situations in which this texture can be optimized.

This property has a correlated global property. As any other NinevehGL Global Property, the final value will be taken from here only if the global property is NGL_NULL, otherwise the global value will be used.

Declared In

NGLTexture.h

quality

The final texture quality.

@property (nonatomic) NGLTextureQuality quality

Discussion

The final texture quality.

This property has a correlated global property. As any other NinevehGL Global Property, the final value will be taken from here only if the global property is NGL_NULL, otherwise the global value will be used.

Declared In

NGLTexture.h

repeat

The repeat filter which will be applied to the texture.

@property (nonatomic) NGLTextureRepeat repeat

Discussion

The repeat filter which will be applied to the texture.

This property has a correlated global property. As any other NinevehGL Global Property, the final value will be taken from here only if the global property is NGL_NULL, otherwise the global value will be used.

Declared In

NGLTexture.h

type

The texture type.

@property (nonatomic) NGLTextureType type

Discussion

The texture type.

Declared In

NGLTexture.h

Class Methods

texture2DWithFile:

Returns an autoreleased instance of NGLTexture.

+ (id)texture2DWithFile:(NSString *)path

Parameters

path

The file system path for the image file. This method uses NinevehGL Path API.

Return Value

A NGLTexture autoreleased instance.

Discussion

Returns an autoreleased instance of NGLTexture.

This method also inserts a file path into the new instance.

Declared In

NGLTexture.h

texture2DWithImage:

Returns an autoreleased instance of NGLTexture.

+ (id)texture2DWithImage:(UIImage *)image

Parameters

image

The UIImage to create the texture.

Return Value

A NGLTexture autoreleased instance.

Discussion

Returns an autoreleased instance of NGLTexture.

The NGLTexture returned by this method is initialized with an UIImage instance inside it.

Declared In

NGLTexture.h

Instance Methods

init2DWithFile:

Initializes a new instance of NGLTexture.

- (id)init2DWithFile:(NSString *)path

Parameters

path

The file system path for the image file. This method uses NinevehGL Path API.

Return Value

A new NGLTexture instance.

Discussion

Initializes a new instance of NGLTexture.

This method also inserts a file path into the new instance.

Declared In

NGLTexture.h

init2DWithImage:

Initializes a new instance of NGLTexture.

- (id)init2DWithImage:(UIImage *)image

Parameters

image

The UIImage to create the texture.

Return Value

A NGLTexture autoreleased instance.

Discussion

Initializes a new instance of NGLTexture.

The NGLTexture returned by this method is initialized with an UIImage instance inside it.

Declared In

NGLTexture.h