cocos2d-x中修改窗口背景色

前端之家收集整理的这篇文章主要介绍了cocos2d-x中修改窗口背景色前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
cocos2d-x中默认的窗口背景色是黑色的。这个貌似因为opengl的默认初始化颜色就是黑色。
既然是opengl渲染的,那么初始化的颜色一定是用gl函数处理的,如下
[cpp]
glClearColor(0.0f,0.0f,1.0f);
搜索之,找到一个
[cpp]
void CCDirector::setGLDefaultValues(void)
{
// This method SHOULD be called only after openGLView_ was initialized
CCAssert(m_pobOpenGLView,"opengl view should not be null");
setAlphaBlending(true);
// XXX: Fix me,should enable/disable depth test according the depth format as cocos2d-iphone did
// [self setDepthTest: view_.depthFormat];
setDepthTest(true);
setProjection(m_eProjection);
// 这里设置默认颜色
glClearColor(0.0f,51); font-family:宋体; font-size:14px"> // glClearColor(255.0f,255.0f,51); font-family:宋体; font-size:14px"> }
void CCDirector::setGLDefaultValues(void)
{
// This method SHOULD be called only after openGLView_ was initialized
setAlphaBlending(true);
// [self setDepthTest: view_.depthFormat];
setDepthTest(true);
setProjection(m_eProjection);
// 这里设置默认颜色
}
底下修改为白色。
原文链接:https://www.f2er.com/cocos2dx/339633.html

猜你在找的Cocos2d-x相关文章