ITeye博客

UIView 中加入的cocos2d,背景透明

374016526 · 2015-05-11 11:54 · iphone · cocos2dx · 移动开发 · cocos2d · Markdown

要点是首先pixelFormat:kEAGLColorFormatRGBA8,必须有alpha层才能透明。
然后view设置为透明
glView.opaque = NO;
[director setOpenGLView:glView];
[self.viewController.view setBackgroundColor:[UIColor clearColor]];
[self.viewController.view addSubview:glView];

在3.3 版本下,我是在项目内搜索glClearColor,把CCDirector.cpp里的默认背景色设置,改为透明。不同版本处理略有差异

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。