http://bbs.tairan.com/thread-807-1-1.html

导演
缓冲
信息支持cocos2d v0.99.4和更新的版本
颜色缓冲
这个默认的缓冲时RGB565.它是一个16位的缓冲器,没有alpha(应该是一种cpu架构).为了使用RGBA8颜色换chogn,你需要创建并初始化EAGLView
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
                                                                   pixelFormat:kEAGLColorFormatRGBA8];
kEAGLColorFormatRGBA8:创建一个RGBA8颜色缓冲(32位)
kEAGLColorFormatRGB565:创建一个RGB565颜色缓冲(16位)。更快的,但是没有alpha

深度缓冲
默认情况下,cocos2d不使用深度缓冲,但是你可以创建一个当你初始化EAGLView用一个16位或者24位深度缓冲
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
                                               pixelFormat:kEAGLColorFormatRGBA8
                                           depthFormat:GL_DEPTH_COMPONENT24_OES];
GL_DEPTH_COMPONENT24_OES:24位深度缓冲
GL_DEPTH_COMPONENT16_OES:16位深度缓冲
0:没有深度缓冲被创建

高资源
自从v0.99.4开始,导演可以设置颜色来呈递缓冲再高资源模型里:
// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
if ([UIScreen instancesRespondToSelector:@selector(scale)])
        [director setContentScaleFactor:[[UIScreen mainScreen] scale]];
从v0.99.5开始,开始支持视网膜屏幕显示:
// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
if( ! [director enableRetinaDisplay:YES] )
        CCLOG(@"Retina Display Not supported");
它是怎么工作的:
如果你有一台iphon4,显示方案是960*640

多点抽样,或者全屏Anti_Aliasing
多点抽样可以执行在所有的设备上,但是在MBX设备中表现的冲击力更剧烈
怎么使用它
不要使用CC_DIRECTOR_INIT() macro。可以用下面的例子作为一个简单的模型
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
        // Init the window
        window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

// must be called before any other call to the director
        [CCDirector setDirectorType:kCCDirectorTypeDisplayLink];

// before creating any layer, set the landscape mode
        CCDirector *director = [CCDirector sharedDirector];

// landscape orientation
        [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];

// set FPS at 60
        [director setAnimationInterval:1.0/60];

// Display FPS: yes
        [director setDisplayFPS:YES];

// Create an EAGLView with a RGB8 color buffer, and a depth buffer of 24-bits
        EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
                   pixelFormat:kEAGLColorFormatRGBA8                // RGBA8 color buffer
                   depthFormat:GL_DEPTH_COMPONENT24_OES   // 24-bit depth buffer
                   preserveBackbuffer:NO
                   sharegroup:nil //for sharing OpenGL contexts between threads
                   multiSampling:NO //YES to enable it
                   numberOfSamples:0 //can be 1 - 4 if multiSampling=YES
        ];

// attach the openglView to the director
        [director setOpenGLView:glView];

// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
        if( ! [director enableRetinaDisplay:YES] )
                CCLOG(@"Retina Display Not supported");

// make the OpenGLView a child of the main window
        [window addSubview:glView];

// make main window visible
        [window makeKeyAndVisible];

// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
        // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
        // You can change anytime.
        [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];

// create the main scene
        CCScene *scene = [...];

// and run it!
        [director runWithScene: scene];

return YES;
}

 
 
 
 

cocos2d programming guide翻译(12)的更多相关文章

  1. cocos2d programming guide 翻译 引导页(完结)

    http://bbs.tairan.com/article-25-1.html  Cocos2d官方入门指导 原文地址:http://www.cocos2d-iphone.org/wiki/doku. ...

  2. cocos2d Programming Guide

    http://python.cocos2d.org/doc/programming_guide/index.html The cocos2d Programming Guide provides in ...

  3. AVFoundation Programming Guide(官方文档翻译4)Editing - 编辑

    新博客:完整版 - AVFoundation Programming Guide 分章节版:- 第1章:About AVFoundation - AVFoundation概述- 第2章:Using A ...

  4. 【IOS笔记】View Programming Guide for iOS -1

    原文:View Programming Guide for iOS View and Window Architecture Views and windows present your applic ...

  5. [IoLanguage]Io Programming Guide[转]

    Io Programming Guide     Introduction Perspective Getting Started Downloading Installing Binaries Ru ...

  6. Structured Streaming Programming Guide结构化流编程指南

    目录 Overview Quick Example Programming Model Basic Concepts Handling Event-time and Late Data Fault T ...

  7. View Programming Guide for iOS_读书笔记[正在更新……]

    原文:View Programming Guide for iOS 1 Introduction 先熟悉一下基本概念. Window Windows do not have any visible c ...

  8. View Controller Programming Guide for iOS---(二)---View Controller Basics

    View Controller Basics Apps running on iOS–based devices have a limited amount of screen space for d ...

  9. View Programming Guide for iOS ---- iOS 视图编程指南(二)---View and Window Architecture

    View and Window Architecture 视图和窗口架构 Views and windows present your application’s user interface and ...

随机推荐

  1. SGU 169 numbers 数学

    169.Numbers Let us call P(n) - the product of all digits of number n (in decimal notation). For exam ...

  2. HyperLedger Fabric 1.4 区块链技术定义(2.1)

    区块链技术指使用点对点传输.共识机制.加密算法等技术,保证分布式数据库区块写入链中数据的一致性,达到去中心化和不可篡改的目的.       区块链就是一种特殊的分布式数据库,使用现有的各种成熟的技术, ...

  3. Kafka写入流程和副本策略

    Kafka写入流程: 1.producer 先从 zookeeper 的 "/brokers/.../state" 节点找到该 partition 的 leader 2. prod ...

  4. python的高阶函数与匿名函数

    一.高阶函数的定义 高阶函数:就是把函数当成参数传递的一种函数,例如: def add(x,y,f): return f(x)+f(y) print(add(-8,11,abs) 结果:19 解释: ...

  5. Eclipse 视图---Eclipse教程第05课

    关于视图 Eclipse视图允许用户以图表形式更直观的查看项目的元数据. 例如,项目导航视图中显示的文件夹和文件图形表示在另外一个编辑窗口中相关的项目和属性视图. Eclipse 透视图(perspe ...

  6. jquery取值赋值

    ("#A").val("1") id为A的值就是1了 jQuery中都这样,赋值的时候作为参数传给函数,和单纯的js有区别,像 $("#A" ...

  7. 剑指Offer - 九度1515 - 打印1到最大的N位数

    剑指Offer - 九度1515 - 打印1到最大的N位数2013-11-30 01:11 题目描述: 给定一个数字N,打印从1到最大的N位数. 输入: 每个输入文件仅包含一组测试样例.对于每个测试案 ...

  8. python3 打印九九乘法口诀表

    for i in range(1, 10): for j in range(1, i+1): # print(f'{i}×{j}={i*j}', end='\t') print('%d×%d=%d' ...

  9. yum常规操作的基本用法

    比如说,我想用nano编辑器的,发现没有安装, 这个时候你就可以用$ yum search nano 查询nano属于哪个安装包下. 发现就有nano这个安装包, 这个时候安装一下这个安装包,$ su ...

  10. python-isinstance,issubclass

    1 #当存在继承关系时,两个类中存在相同的方法,如何执行父类的方法,通过super 2 class C1: 3 def f1(self): 4 print('c1.f1') 5 6 7 class C ...