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. C语言进阶——struct和union分析10

    struct的小秘密: C语言中的struct可以看作变量的集合 struct的问题:空结构体占用多大内存呢? 程序实例1: #include <stdio.h> struct TS { ...

  2. [Noip2016]组合数(数论)

    题目描述 组合数表示的是从n个物品中选出m个物品的方案数.举个例子,从(1,2,3) 三个物品中选择两个物品可以有(1,2),(1,3),(2,3)这三种选择方法.根据组合数的定 义,我们可以给出计算 ...

  3. scrapy进行分布式爬虫

    今天,参照崔庆才老师的爬虫实战课程,实践了一下分布式爬虫,并没有之前想象的那么神秘,其实非常的简单,相信你看过这篇文章后,不出一小时,便可以动手完成一个分布式爬虫! 1.分布式爬虫原理 首先我们来看一 ...

  4. 9.5web service基础知识

    Web服务基础 用户访问网站的基本流程 我们每天都会用web客户端上网,浏览器就是一个web客户端,例如谷歌浏览器,以及火狐浏览器等. 当我们输入www.oldboyedu.com/时候,很快就能看到 ...

  5. P1182 数列分段Section II

    P1182 数列分段Section II 题目描述 对于给定的一个长度为N的正整数数列A[i],现要将其分成M(M≤N)段,并要求每段连续,且每段和的最大值最小. 关于最大值最小: 例如一数列4 2 ...

  6. CC3200模块的内存地址划分和bootloader,启动流程(二)

    1. 首先启动内部ROM固化的BOOT,然后这个ROM启动需要使用内存空间0X2000 0000 --- 0X2000 4000共16K的空间.一级BOOT的作用是串口升级和驱动库. 2. 然后是二级 ...

  7. 《Cracking the Coding Interview》——第5章:位操作——题目4

    2014-03-19 06:15 题目:解释(n & (n - 1)) == 0是什么意思? 解法:n&n-1是去掉最低位‘1’的方法.根据运算符优先级,貌似用不着加那个括号,但位运算 ...

  8. 【vim环境配置】详细实录

    [写在前面] 以下的所有内容主要参照: https://github.com/yangyangwithgnu/use_vim_as_ide . 原blog作者写的非常用心,建议大家都去看看.(个人觉得 ...

  9. 遍历两个自定义列表来实现字典(key:value)

    #自定义key    ${keys}    create list    key1    key2    key3 #自定义value    ${values}    create list    v ...

  10. python 学习分享-进程

    python中的多线程其实并不是真正的多线程,如果想要充分地使用多核CPU的资源,在python中大部分情况需要使用多进程.Python提供了非常好用的多进程包multiprocessing,只需要定 ...