KudanAR - iOS  1.6.0
ARTexture Class Reference

#import <ARTexture.h>

Inherits NSObject.

Inherited by ARPlayableTexture, and ARTextureCube.

Instance Methods

(instancetype) - initWithUIImage:
 
(instancetype) - initWithEmpty
 
(instancetype) - initWithExistingTextureID:
 
(void) - generateTexture
 
(void) - uploadTexture
 
(void) - loadTextureFromUIImage:reverseLines:
 
(void) - uploadBGRATexture:width:height:
 
(void) - uploadBGRATextureSub:width:height:
 
(BOOL) - preRender
 
(void) - postRender
 

Protected Types

enum  ARTextureFilter { ARTextureFilterNearest, ARTextureFilterLinear }
 

Protected Attributes

NSData * _rawImage
 

Properties

GLuint textureID
 
unsigned long width
 
unsigned long height
 
BOOL isPowerOfTwo
 
ARTextureFilter minificationFilter
 
ARTextureFilter magnificationFilter
 

Detailed Description

An ARTexture is a class representing a 2D texture. Textures cannot exceed 2048x2048 pixels in size.

Textures are typically used for images to decorate 3D models, but in reality they can be used to store many different kinds of data on the GPU.

Member Enumeration Documentation

◆ ARTextureFilter

- (enum) ARTextureFilter
protected

Texture filtering modes:

Enumerator
ARTextureFilterNearest 

Use 'Nearest Neighbour' filtering.

ARTextureFilterLinear 

Use Linear Interpolation.

Method Documentation

◆ generateTexture

- (void) generateTexture

Generates a new texture on the GPU using the texture ID.

◆ initWithEmpty

- (instancetype) initWithEmpty

Create an empty texture to be loaded with an image later.

Example of use:

ARTexture *texture = [[ARTexture alloc] initWithEmpty];

◆ initWithUIImage:

- (instancetype) initWithUIImage: (UIImage *)  image

Create a texture from a UIImage.

Example of use:

ARTexture *texture = [[ARTexture alloc] initWithUIImage:[UIImage imageNamed:@"exampleTexture.jpg"]];
Parameters
imageThe UIImage to create the texture from.

◆ loadTextureFromUIImage:reverseLines:

- (void) loadTextureFromUIImage: (UIImage *)  image
reverseLines: (BOOL)  reverseLines 

Loads image data, sets image width and height, sets pixel format, and stores it in the rawImage property.

Parameters
imageImage to generate texture from.
reverseLinesWhether to read pixels from top(YES) or bottom.

◆ postRender

- (void) postRender

Method called just after this texture has been used in rendering.

◆ preRender

- (BOOL) preRender

Method called just before this texture is rendered.

Returns
BOOL Whether or not to proceed with rendering.

◆ uploadTexture

- (void) uploadTexture

Allocate memory on the GPU to the texture and upload texture data to it.

Member Data Documentation

◆ _rawImage

- (NSData*) _rawImage
protected

The raw image data, in bytes. This data is in the RGBA format.

Property Documentation

◆ height

- (unsigned long) height
readwritenonatomicassign

The height of the texture, in pixels.

◆ isPowerOfTwo

- (BOOL) isPowerOfTwo
readwritenonatomicassign

Whether or not this texture is a "Power of Two" texture. A texture is "Power of Two" if and only if its width and height are both some power of 2 (64, 128, 256, 1024, etc). While it is not a problem if a texture is not "Power of Two", there are some features of OpenGL that can only be used with "Power of Two" textures.

◆ magnificationFilter

- (ARTextureFilter) magnificationFilter
readwritenonatomicassign

The filtering type used for magnification. ARTextureFilterLinear is recommended for less aliasing. Magnification is a type of reconstruction filter where sparse data is interpolated to fill gaps.

◆ minificationFilter

- (ARTextureFilter) minificationFilter
readwritenonatomicassign

The filtering type used for minification. ARTextureFilterLinear is recommended for less aliasing. Minification is a type of anti-aliasing, where texture samples exist at a higher frequency than required for the sample frequency needed for texture fill.

◆ textureID

- (GLuint) textureID
readwritenonatomicassign

The texture's handle in OpenGL. This is a reference to the texture and allows access to it on the GPU.

◆ width

- (unsigned long) width
readwritenonatomicassign

The width of the texture, in pixels.


The documentation for this class was generated from the following files:
ARTexture
Definition: ARTexture.h:12
-[ARTexture initWithEmpty]
instancetype initWithEmpty()
Definition: ARTexture.m:225