cocos2d-x用gl绘图出现偏差解决办法

来源:互联网 发布:数控铣床编程代码m99 编辑:程序博客网 时间:2024/05/16 08:26

http://www.cocos2d-x.org/news/24

As the default setting, cocos2d-x uses 3D projection with a depth buffer, in CCDirector::setGLDefaultValues()

voidCCDirector::setGLDefaultValues(void){     // This method SHOULD be called only after openGLView_ was initialized     assert(m_pobOpenGLView);     setAlphaBlending(true);     setDepthTest(true);     setProjection(m_eProjection);       // m_eProjection is set to kCCDirectorProjectionDefault in CCDirector::init(), while     // kCCDirectorProjectionDefault is set to kCCDirectorProjection3D in CCDirector.h     // ...}

So for ipad2 games, don't forget to invoke

// alternative A: Disable Depth TestCCDirector::sharedDirector()->setDepthTest(false);

OR

// alternative B: use 2D projectionCCDirector::sharedDirector()->setProjection(kCCDirectorProjection2D);

Either one is OK. After this modification, please re-test your whole game. setDepthTest may affect some effects, transitions, and tilemap z order behaviours

原创粉丝点击