CCTexture2D class. More...
#include <CCTexture2D.h>
Public Member Functions | |
CCTexture2D () | |
ctor () | |
CCTexture2D () | |
virtual | ~CCTexture2D () |
const char * | description (void) |
void | releaseData (void *data) |
These functions are needed to create mutable textures. More... | |
local | releaseData ( local data) |
These functions are needed to create mutable textures. More... | |
void * | keepData (void *data, unsigned int length) |
local | keepData ( local data, local length) |
bool | initWithData (const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize &contentSize) |
Initializes with a texture2d with data. More... | |
void | drawAtPoint (const CCPoint &point) |
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object. More... | |
void | drawInRect (const CCRect &rect) |
draws a texture inside a rect More... | |
bool | initWithImage (CCImage *uiImage) |
Extensions to make it easy to create a CCTexture2D object from an image file. More... | |
bool | initWithString (const char *text, const char *fontName, float fontSize, const CCSize &dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment) |
Initializes a texture from a string with dimensions, alignment, font name and font size. More... | |
var | initWithString ( var text, var fontName, var fontSize, var dimensions, var hAlignment, var vAlignment) |
Initializes a texture from a string with dimensions, alignment, font name and font size. More... | |
local | initWithString ( local text, local fontName, local fontSize, local dimensions, local hAlignment, local vAlignment) |
Initializes a texture from a string with dimensions, alignment, font name and font size. More... | |
bool | initWithString (const char *text, const char *fontName, float fontSize) |
Initializes a texture from a string with font name and font size. More... | |
bool | initWithString (const char *text, ccFontDefinition *textDefinition) |
Initializes a texture from a string using a text definition. More... | |
bool | initWithPVRFile (const char *file) |
Initializes a texture from a PVR file. More... | |
bool | initWithETCFile (const char *file) |
Initializes a texture from a ETC file. More... | |
var | initWithETCFile ( var file) |
Initializes a texture from a ETC file. More... | |
local | initWithETCFile ( local file) |
Initializes a texture from a ETC file. More... | |
void | setTexParameters (ccTexParams *texParams) |
sets the min filter, mag filter, wrap s and wrap t texture parameters. More... | |
void | setAntiAliasTexParameters () |
sets antialias texture parameters: More... | |
void | setAliasTexParameters () |
sets alias texture parameters: More... | |
void | generateMipmap () |
Generates mipmap images for the texture. More... | |
const char * | stringForFormat () |
returns the pixel format. More... | |
local | stringForFormat () |
returns the pixel format. More... | |
unsigned int | bitsPerPixelForFormat () |
returns the bits-per-pixel of the in-memory OpenGL texture More... | |
unsigned int | bitsPerPixelForFormat (CCTexture2DPixelFormat format) |
Helper functions that returns bits per pixels for a given format. More... | |
const CCSize & | getContentSizeInPixels () |
content size More... | |
bool | hasPremultipliedAlpha () |
var | hasPremultipliedAlpha () |
local | hasPremultipliedAlpha () |
bool | hasMipmaps () |
var | hasMipmaps () |
local | hasMipmaps () |
virtual CCTexture2DPixelFormat | getPixelFormat (void) |
getPixelFormat More... | |
local | getPixelFormat () |
getPixelFormat More... | |
virtual unsigned int | getPixelsWide (void) |
getPixelsWide More... | |
virtual unsigned int | getPixelsHigh (void) |
getPixelsHigh More... | |
virtual GLuint | getName (void) |
getName More... | |
var | getName () |
getName More... | |
local | getName () |
getName More... | |
virtual GLfloat | getMaxS (void) |
getMaxS More... | |
local | getMaxS () |
getMaxS More... | |
virtual void | setMaxS (GLfloat var) |
setMaxS More... | |
local | setMaxS ( local var) |
setMaxS More... | |
virtual GLfloat | getMaxT (void) |
getMaxT More... | |
local | getMaxT () |
getMaxT More... | |
virtual void | setMaxT (GLfloat var) |
setMaxT More... | |
local | setMaxT ( local var) |
setMaxT More... | |
virtual CCSize | getContentSize (void) |
getContentSize More... | |
local | getContentSize () |
getContentSize More... | |
virtual CCGLProgram * | getShaderProgram (void) |
getShaderProgram More... | |
var | getShaderProgram () |
getShaderProgram More... | |
local | getShaderProgram () |
getShaderProgram More... | |
virtual void | setShaderProgram (CCGLProgram *var) |
setShaderProgram More... | |
Public Member Functions inherited from CCObject | |
CCObject (void) | |
virtual | ~CCObject (void) |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
Public Member Functions inherited from CCCopying | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
Static Public Member Functions | |
static void | setDefaultAlphaPixelFormat (CCTexture2DPixelFormat format) |
sets the default pixel format for UIImagescontains alpha channel. More... | |
local | setDefaultAlphaPixelFormat ( local format) |
sets the default pixel format for UIImagescontains alpha channel. More... | |
static CCTexture2DPixelFormat | defaultAlphaPixelFormat () |
returns the alpha pixel format More... | |
static void | PVRImagesHavePremultipliedAlpha (bool haveAlphaPremultiplied) |
treats (or not) PVR files as if they have alpha premultiplied. More... | |
var | PVRImagesHavePremultipliedAlpha ( var haveAlphaPremultiplied) |
treats (or not) PVR files as if they have alpha premultiplied. More... | |
local | PVRImagesHavePremultipliedAlpha ( local haveAlphaPremultiplied) |
treats (or not) PVR files as if they have alpha premultiplied. More... | |
Public Attributes | |
bool | m_bHasPremultipliedAlpha |
whether or not the texture has their Alpha premultiplied More... | |
var | m_bHasPremultipliedAlpha |
whether or not the texture has their Alpha premultiplied More... | |
local | m_bHasPremultipliedAlpha |
whether or not the texture has their Alpha premultiplied More... | |
bool | m_bHasMipmaps |
var | m_bHasMipmaps |
local | m_bHasMipmaps |
Public Attributes inherited from CCObject | |
unsigned int | m_uID |
int | m_nLuaID |
Protected Attributes | |
CCTexture2DPixelFormat | m_ePixelFormat |
pixel format of the texture More... | |
var | m_ePixelFormat |
pixel format of the texture More... | |
local | m_ePixelFormat |
pixel format of the texture More... | |
unsigned int | m_uPixelsWide |
width in pixels More... | |
unsigned int | m_uPixelsHigh |
height in pixels More... | |
var | m_uPixelsHigh |
height in pixels More... | |
local | m_uPixelsHigh |
height in pixels More... | |
GLuint | m_uName |
texture name More... | |
var | m_uName |
texture name More... | |
local | m_uName |
texture name More... | |
GLfloat | m_fMaxS |
texture max S More... | |
var | m_fMaxS |
texture max S More... | |
local | m_fMaxS |
texture max S More... | |
GLfloat | m_fMaxT |
texture max T More... | |
var | m_fMaxT |
texture max T More... | |
local | m_fMaxT |
texture max T More... | |
CCSize | m_tContentSize |
content size More... | |
var | m_tContentSize |
content size More... | |
local | m_tContentSize |
content size More... | |
CCGLProgram * | m_pShaderProgram |
shader program used by drawAtPoint and drawInRect More... | |
var | m_pShaderProgram |
shader program used by drawAtPoint and drawInRect More... | |
local | m_pShaderProgram |
shader program used by drawAtPoint and drawInRect More... | |
Protected Attributes inherited from CCObject | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
CCTexture2D class.
This class allows to easily create OpenGL 2D textures from images, text or raw data. The created CCTexture2D object will always have power-of-two dimensions. Depending on how you create the CCTexture2D object, the actual image area of the texture might be smaller than the texture dimensions i.e. "contentSize" != (pixelsWide, pixelsHigh) and (maxS, maxT) != (1.0, 1.0). Be aware that the content of the generated textures will be upside-down!
CCTexture2D | ( | ) |
var ctor | ( | ) |
local CCTexture2D | ( | ) |
|
virtual |
unsigned int bitsPerPixelForFormat | ( | ) |
returns the bits-per-pixel of the in-memory OpenGL texture
var bitsPerPixelForFormat | ( | ) |
returns the bits-per-pixel of the in-memory OpenGL texture
local bitsPerPixelForFormat | ( | ) |
returns the bits-per-pixel of the in-memory OpenGL texture
unsigned int bitsPerPixelForFormat | ( | CCTexture2DPixelFormat | format) |
Helper functions that returns bits per pixels for a given format.
var bitsPerPixelForFormat | ( | var | format) |
Helper functions that returns bits per pixels for a given format.
local bitsPerPixelForFormat | ( | local | format) |
Helper functions that returns bits per pixels for a given format.
|
static |
returns the alpha pixel format
|
static |
returns the alpha pixel format
|
static |
returns the alpha pixel format
const char* description | ( | void | ) |
void drawAtPoint | ( | const CCPoint & | point) |
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object.
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.draws a texture at a given point
var drawAtPoint | ( | var | point) |
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object.
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.draws a texture at a given point
local drawAtPoint | ( | local | point) |
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object.
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.draws a texture at a given point
void drawInRect | ( | const CCRect & | rect) |
draws a texture inside a rect
var drawInRect | ( | var | rect) |
draws a texture inside a rect
local drawInRect | ( | local | rect) |
draws a texture inside a rect
void generateMipmap | ( | ) |
Generates mipmap images for the texture.
It only works if the texture size is POT (power of 2).
var generateMipmap | ( | ) |
Generates mipmap images for the texture.
It only works if the texture size is POT (power of 2).
local generateMipmap | ( | ) |
Generates mipmap images for the texture.
It only works if the texture size is POT (power of 2).
|
virtual |
getContentSize
|
virtual |
getContentSize
|
virtual |
getContentSize
const CCSize& getContentSizeInPixels |
( | ) |
content size
var getContentSizeInPixels | ( | ) |
content size
local getContentSizeInPixels | ( | ) |
content size
|
virtual |
getMaxS
|
virtual |
getMaxS
|
virtual |
getMaxS
|
virtual |
getMaxT
|
virtual |
getMaxT
|
virtual |
getMaxT
|
virtual |
getName
|
virtual |
getName
|
virtual |
getName
|
virtual |
getPixelFormat
|
virtual |
getPixelFormat
|
virtual |
getPixelFormat
|
virtual |
getPixelsHigh
|
virtual |
getPixelsHigh
|
virtual |
getPixelsHigh
|
virtual |
getPixelsWide
|
virtual |
getPixelsWide
|
virtual |
getPixelsWide
|
virtual |
getShaderProgram
|
virtual |
getShaderProgram
|
virtual |
getShaderProgram
bool hasMipmaps | ( | ) |
var hasMipmaps | ( | ) |
local hasMipmaps | ( | ) |
bool hasPremultipliedAlpha | ( | ) |
var hasPremultipliedAlpha | ( | ) |
local hasPremultipliedAlpha | ( | ) |
bool initWithData | ( | const void * | data, |
CCTexture2DPixelFormat | pixelFormat, | ||
unsigned int | pixelsWide, | ||
unsigned int | pixelsHigh, | ||
const CCSize & | contentSize | ||
) |
Initializes with a texture2d with data.
bool initWithETCFile | ( | const char * | file) |
Initializes a texture from a ETC file.
var initWithETCFile | ( | var | file) |
Initializes a texture from a ETC file.
local initWithETCFile | ( | local | file) |
Initializes a texture from a ETC file.
bool initWithImage | ( | CCImage * | uiImage) |
Extensions to make it easy to create a CCTexture2D object from an image file.
Note that RGBA type textures will have their alpha premultiplied - use the blending mode (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).Initializes a texture from a UIImage object
var initWithImage | ( | var | uiImage) |
Extensions to make it easy to create a CCTexture2D object from an image file.
Note that RGBA type textures will have their alpha premultiplied - use the blending mode (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).Initializes a texture from a UIImage object
local initWithImage | ( | local | uiImage) |
Extensions to make it easy to create a CCTexture2D object from an image file.
Note that RGBA type textures will have their alpha premultiplied - use the blending mode (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).Initializes a texture from a UIImage object
bool initWithPVRFile | ( | const char * | file) |
Initializes a texture from a PVR file.
var initWithPVRFile | ( | var | file) |
Initializes a texture from a PVR file.
local initWithPVRFile | ( | local | file) |
Initializes a texture from a PVR file.
bool initWithString | ( | const char * | text, |
const char * | fontName, | ||
float | fontSize, | ||
const CCSize & | dimensions, | ||
CCTextAlignment | hAlignment, | ||
CCVerticalTextAlignment | vAlignment | ||
) |
Initializes a texture from a string with dimensions, alignment, font name and font size.
var initWithString | ( | var | text, |
var | fontName, | ||
var | fontSize, | ||
var | dimensions, | ||
var | hAlignment, | ||
var | vAlignment | ||
) |
Initializes a texture from a string with dimensions, alignment, font name and font size.
local initWithString | ( | local | text, |
local | fontName, | ||
local | fontSize, | ||
local | dimensions, | ||
local | hAlignment, | ||
local | vAlignment | ||
) |
Initializes a texture from a string with dimensions, alignment, font name and font size.
bool initWithString | ( | const char * | text, |
const char * | fontName, | ||
float | fontSize | ||
) |
Initializes a texture from a string with font name and font size.
var initWithString | ( | var | text, |
var | fontName, | ||
var | fontSize | ||
) |
Initializes a texture from a string with font name and font size.
local initWithString | ( | local | text, |
local | fontName, | ||
local | fontSize | ||
) |
Initializes a texture from a string with font name and font size.
bool initWithString | ( | const char * | text, |
ccFontDefinition * | textDefinition | ||
) |
Initializes a texture from a string using a text definition.
var initWithString | ( | var | text, |
var | textDefinition | ||
) |
Initializes a texture from a string using a text definition.
local initWithString | ( | local | text, |
local | textDefinition | ||
) |
Initializes a texture from a string using a text definition.
void* keepData | ( | void * | data, |
unsigned int | length | ||
) |
local keepData | ( | local | data, |
local | length | ||
) |
|
static |
treats (or not) PVR files as if they have alpha premultiplied.
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is possible load them as if they have (or not) the alpha channel premultiplied.
By default it is disabled.
|
static |
treats (or not) PVR files as if they have alpha premultiplied.
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is possible load them as if they have (or not) the alpha channel premultiplied.
By default it is disabled.
|
static |
treats (or not) PVR files as if they have alpha premultiplied.
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is possible load them as if they have (or not) the alpha channel premultiplied.
By default it is disabled.
void releaseData | ( | void * | data) |
These functions are needed to create mutable textures.
local releaseData | ( | local | data) |
These functions are needed to create mutable textures.
void setAliasTexParameters | ( | ) |
sets alias texture parameters:
var setAliasTexParameters | ( | ) |
sets alias texture parameters:
local setAliasTexParameters | ( | ) |
sets alias texture parameters:
void setAntiAliasTexParameters | ( | ) |
sets antialias texture parameters:
var setAntiAliasTexParameters | ( | ) |
sets antialias texture parameters:
local setAntiAliasTexParameters | ( | ) |
sets antialias texture parameters:
|
static |
sets the default pixel format for UIImagescontains alpha channel.
If the UIImage contains alpha channel, then the options are:
How does it work ?
This parameter is not valid for PVR / PVR.CCZ images.
|
static |
sets the default pixel format for UIImagescontains alpha channel.
If the UIImage contains alpha channel, then the options are:
How does it work ?
This parameter is not valid for PVR / PVR.CCZ images.
|
static |
sets the default pixel format for UIImagescontains alpha channel.
If the UIImage contains alpha channel, then the options are:
How does it work ?
This parameter is not valid for PVR / PVR.CCZ images.
|
virtual |
setMaxS
|
virtual |
setMaxS
|
virtual |
setMaxS
|
virtual |
setMaxT
|
virtual |
setMaxT
|
virtual |
setMaxT
|
virtual |
setShaderProgram
|
virtual |
setShaderProgram
|
virtual |
setShaderProgram
void setTexParameters | ( | ccTexParams * | texParams) |
sets the min filter, mag filter, wrap s and wrap t texture parameters.
If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}.
var setTexParameters | ( | var | texParams) |
sets the min filter, mag filter, wrap s and wrap t texture parameters.
If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}.
local setTexParameters | ( | local | texParams) |
sets the min filter, mag filter, wrap s and wrap t texture parameters.
If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}.
const char* stringForFormat | ( | ) |
returns the pixel format.
var stringForFormat | ( | ) |
returns the pixel format.
local stringForFormat | ( | ) |
returns the pixel format.
bool m_bHasMipmaps |
var m_bHasMipmaps |
local m_bHasMipmaps |
bool m_bHasPremultipliedAlpha |
whether or not the texture has their Alpha premultiplied
var m_bHasPremultipliedAlpha |
whether or not the texture has their Alpha premultiplied
local m_bHasPremultipliedAlpha |
whether or not the texture has their Alpha premultiplied
|
protected |
pixel format of the texture
|
protected |
pixel format of the texture
|
protected |
pixel format of the texture
|
protected |
texture max S
|
protected |
texture max S
|
protected |
texture max S
|
protected |
texture max T
|
protected |
texture max T
|
protected |
texture max T
|
protected |
shader program used by drawAtPoint and drawInRect
|
protected |
shader program used by drawAtPoint and drawInRect
|
protected |
shader program used by drawAtPoint and drawInRect
|
protected |
content size
|
protected |
content size
|
protected |
content size
|
protected |
texture name
|
protected |
texture name
|
protected |
texture name
|
protected |
height in pixels
|
protected |
height in pixels
|
protected |
height in pixels
|
protected |
width in pixels
|
protected |
width in pixels
|
protected |
width in pixels