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. Uva12230Crossing Rivers 数学

    Uva12230Crossing Rivers 问题: You live in a village but work in another village. You decided to follow ...

  2. Hive 中的 UDF

    LanguageManual UDF 一.分类 UDF:User defined function 用户定义函数 一进一出 UDAF:User defined aggregation function ...

  3. python读取文件

    请参考:http://www.cnblogs.com/sysuoyj/archive/2012/03/14/2395789.html

  4. 20145202马超《java程序设计》第一周学习总结

    这两天的学习让我对java有了初步的了解. 1.java是SUN公司推出的面相网络的编程语言. 特点:完全面向对象,与平台无关,跨平台性(例如c++只能在windows上执行,然而java并没有这些限 ...

  5. 14,flask-sqlalchemy项目配置

    基于一个flask项目,加入flask-SQLAlchemy 1.加入falsk-sqlalchemy第三方组件 from flask import Flask # 导入Flask-SQLAlchem ...

  6. node-sass安装不成功的问题

    SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass 简单粗暴的执行上述的命令.

  7. Android stadio 自定义debug release keystore

    1.添加siggnig name 随意,不过按我写的就可以了.设置完成之后,你的build.grade就会多出来一些: android { signingConfigs { signingConfig ...

  8. QQ空间相册展示特效

    <!doctype html> <html lang="en"> <head> <title>QQ空间相册展示特效<title ...

  9. java编程-无锁初始化

    private final Node<K,V>[] initTable() { Node<K,V>[] tab; int sc; while ((tab = table) == ...

  10. 【Power of Two】cpp

    题目: Given an integer, write a function to determine if it is a power of two. 代码: class Solution { pu ...