【问题标题】:CCLabelBMFont setString cause OpenGL error 0x0500CCLabelBMFont setString 导致 OpenGL 错误 0x0500
【发布时间】:2015-01-31 06:59:54
【问题描述】:

Cocos2d:OpenGL 错误 0x0500 CCTextureAtlas.cpp drawNumberOfQuads 686

当我用 setString 更新 word 时,OpenGL 会出现滚动错误。或者用文字初始化 CCLabelBMFont。

cocos2d.x.version: cocos2d-x 2.2.6
cocos2d.x.compiled_with_profiler: false
cocos2d.x.compiled_with_gl_state_cache: true
gl.vendor: Apple Inc.
gl.renderer: Apple A8 GPU
gl.version: OpenGL ES 2.0 Apple A8 GPU - 50.6.10
gl.max_texture_size: 4096
gl.max_texture_units: 8
gl.max_samples_allowed: 4
gl.supports_PVRTC: true
gl.supports_NPOT: true
gl.supports_BGRA8888: false
gl.supports_discard_framebuffer: true
gl.supports_vertex_array_object: true

【问题讨论】:

  • 你能粘贴你的代码吗?那会更容易理解。
  • @shaqirsaiyed thx,我终于修复了错误。

标签: opengl cocos2d-x


【解决方案1】:

我解决了我的问题。不是cocos2dx的问题.....

池代码原因:

void Box2dCCSprite::setOpacity(GLubyte opacity){
super::setOpacity(opacity);
if (m_pChildren) {
    for (int i=m_pChildren->count()-1; i>=0; i--) {
        CCSprite* child = dynamic_cast<CCSprite*>(m_pChildren->objectAtIndex(i));
        //CCSprite* child=(CCSprite*)m_pChildren->objectAtIndex(i);
        if (child) {
            child->setOpacity(opacity);
        }
    }
}

}

注释是错误代码。

【讨论】:

  • @shaqirsaiyed 其实并不是所有的孩子都是 CCSprite
  • ohwkey ,所以你只想为那些 CCsprites 的孩子设置不透明度,对吧?? . .
  • @shaqirsaiyed 是的
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-07-13
  • 2016-08-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多