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 通过图片 文本 和 数据生成OpenGL 2D纹理。
拥有俩个尺寸
CCTextureAtlas
A class that implements a Texture Atlas.
Supported features: The atlas file can be a PVRTC, PNG or any other fomrat supported by Texture2D Quads can be udpated in runtime Quads can be added in runtime Quads can be removed in runtime Quads can be re-ordered in runtime The TextureAtlas capacity can be increased or decreased in runtime OpenGL component: V3F, C4B, T2F. The quads are rendered using an OpenGL ES VBO. To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file
TextureAtlas
(以下内容是:cocoachina的猪头解释的,原贴在:http://www.cocoachina.com/bbs/read.php?tid-8261.html)
供AtlasSpriteManager与AtlasSprite的材质类
从Texture2D继承而来,在其基础上增加了一个非常重要的成员变量
ccV3F_C4B_T2F_Quad * quads
实际上AtlasSprite相比Sprite能快更得进行大批量渲染也是因为这个
TextureAtlas维护了一个ccV3F_C4B_T2F_Quad数组,使用一张texture进行batch render
其他与Texture2d没什么不同
这个过程是这样的:
1.首先是AtlasSpriteManager使用一张TextureAtlas初始化,并设定Quad数组的长度
2.往AtlasSpriteManager加入AtlasSprite,这个加入的过程其实只是往AtlasSpriteManager的Quad数组中更新一个Quad
3.渲染的时候 使用一张Texture根据Quad数组中的不同值一个个渲染
支持的特征有:
1、地图集文件可以是PVRTC PNG 或者其他Texture2D支持的格式;
2、四边形可以在运行期间被添加、移除、重新排序
3、TextureAtlas 的capacity(包括ccV3F_C4B_T2F_Quad数组的容器)能够在运行期被增加或减少
4、OpenGL的组件:V3F,C4B,T2F
呈现的四边形是使用OpenGL ES的交错的顶点数组列表
CCTextureCache Class
Singleton that handles the loading of textures Once the texture is loaded, the next time it will return a reference of the previously loaded texture reducing GPU & CPU memory.
可以理解为texture的缓存集合
CCTexture2D->CCTextureAtlas
CCTextureCache 包含CCTexture2D and CCTextureAtlas