Inherits from CCTexture
Declared in CC3Texture.h

Overview

A CCTexture subclass used by the CC3Texture class cluster during the loading of a 2D texture, and when extracting a CCTexture from the CC3Texture ccTexture property.

PVR texture files cannot be loaded using this class.

Class Methods

textureFromCC3Texture:

Allocates and initializes an instance to represent the same GL texture as the specified CC3Texture.

+ (id)textureFromCC3Texture:(CC3Texture *)texture

Declared In

CC3Texture.h

textureWithSize:withColor:

Allocates and initializes an autoreleased instance containing pixel content of the specified size and solid, uniform color.

+ (id)textureWithSize:(CC3IntSize)size withColor:(ccColor4B)color

Discussion

This method is useful for creating a blank tetxure canvas of a particular size and color. By accessing the imageData property, the application can then draw pixels to this canvas.

Declared In

CC3Texture.h

Instance Methods

deleteImageData

Deletes the texture content from main memory. This should be invoked once the texture is bound to the GL engine.

- (void)deleteImageData

Declared In

CC3Texture.h

flipHorizontally

Flips this texture horizontally.

- (void)flipHorizontally

Declared In

CC3Texture.h

flipVertically

Flips this texture vertically, to compensate for the opposite orientation of vertical graphical coordinates between OpenGL and iOS & OSX.

- (void)flipVertically

Discussion

The value of the isUpsideDown property is toggled after flipping.

Declared In

CC3Texture.h

initFromCC3Texture:

Initializes this instance to represent the same GL texture as the specified CC3Texture.

- (id)initFromCC3Texture:(CC3Texture *)texture

Declared In

CC3Texture.h

initFromFile:

Initializes this instance with content loaded from the specified file.

- (id)initFromFile:(NSString *)filePath

Discussion

The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.

Returns nil if the file could not be loaded.

The value of the isUpsideDown is set to YES.

Declared In

CC3Texture.h

initWithCGImage:

Initializes this instance from the content in the specified CGImage.

- (id)initWithCGImage:(CGImageRef)cgImg

Discussion

The value of the isUpsideDown is set to YES.

Declared In

CC3Texture.h

initWithSize:andPixelFormat:andPixelType:

@deprecated Use initWithSize:withPixelFormat:withPixelType:

- (id)initWithSize:(CC3IntSize)size andPixelFormat:(GLenum)format andPixelType:(GLenum)type

Declared In

CC3Texture.h

initWithSize:withColor:

Initializes this instance containing pixel content of the specified size and solid, uniform color.

- (id)initWithSize:(CC3IntSize)size withColor:(ccColor4B)color

Discussion

This method is useful for creating a blank tetxure canvas of a particular size and color. By accessing the imageData property, the application can then draw pixels to this canvas.

Declared In

CC3Texture.h

initWithSize:withPixelFormat:withPixelType:

Initializes this instance to define the properties of a texture, without defining any specific content.

- (id)initWithSize:(CC3IntSize)size withPixelFormat:(GLenum)format withPixelType:(GLenum)type

Discussion

This instance can be used to initialize an empty CC3Texture, to which content can be added later.

The value of the isUpsideDown is set to NO.

Declared In

CC3Texture.h

resizeTo:

Resizes this texture to the specified dimensions.

- (void)resizeTo:(CC3IntSize)size

Discussion

This method changes the values of the size, width, height, maxS & maxT properties, but does not make any changes to the texture within the GL engine. This method is invoked during the resizing of a texture that backs a surface.

Declared In

CC3Texture.h

rotateHalfCircle

Rotates the image by 180 degrees.

- (void)rotateHalfCircle

Discussion

This is equivalent to combined vertical and horizontal flips, but is executed in one pass for efficiency.

The value of the isUpsideDown property is toggled after rotating.

Declared In

CC3Texture.h