cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.13k stars 7.05k forks source link

Bug about CCControlSwitch on 2.1.4 release #3093

Closed emmychen closed 11 years ago

emmychen commented 11 years ago

I got this error message from CCControlSwitch

Cocos2d: OpenGL error 0x0502 in /Users/emmychen/cocos2d-x-proj/cocos2dx/proj.ios/../sprite_nodes/CCSprite.cpp draw 591

CCControlSwitch *switchControl = CCControlSwitch::create
(
 CCSprite::create("switch-mask.png"),
 CCSprite::create("switch-on.png"),
 CCSprite::create("switch-off.png"),
 CCSprite::create("switch-thumb.png"),
 CCLabelTTF::create("On", "Arial-BoldMT", 16),
 CCLabelTTF::create("Off", "Arial-BoldMT", 16)
 );

The switch-mask.png does not show on the screen.
It happened in the TestCpp too.

Emmy

dumganhar commented 11 years ago

Thanks @emmychen Yep, it's a bug in v2.1.4. But it was fixed at

https://github.com/cocos2d/cocos2d-x/pull/3065/files (First Pull Request, not resolved) https://github.com/cocos2d/cocos2d-x/pull/3067/files (Second Pull Request, Resolved)

You could easily modify the codes based on v2.1.4 to resolve this issue. If there is any difficulty, please let me know. Thanks.

James

emmychen commented 11 years ago

Hi James: Thanks for the quick respond. I have an issue about kShader_PositionColor.

Where did you define kShader_PositionColor?

Emmy On Jul 7, 2013, at 7:16 PM, James Chen wrote:

Resolved

dumganhar commented 11 years ago

In cocos2dx/shaders/CCGLProgram.h:

#define kShader_PositionColor                     "ShaderPositionColor"
emmychen commented 11 years ago

found it. it works now. Thanks for the help!

dumganhar commented 11 years ago

My pleasure. :)

emmychen commented 11 years ago

error

When I created more than one CCControlSwitch, I got the problem like displayed on the image. Any idea how to fix it?

dumganhar commented 11 years ago

No idea yet. I created an issue http://cocos2d-x.org/issues/2381 here.

emmychen commented 11 years ago

Is there anyway to fix this earlier? I am about ready to release this app. Just waiting for this to be fixed.

dumganhar commented 11 years ago

OK, I'll check it out as soon as possible, but you know that we're very busy. :) Anyway, when I get the result, I'll let you know.

emmychen commented 11 years ago

Thanks. I will use other menu items to work around this for now.

dumganhar commented 11 years ago

@emmychen It was fixed at https://github.com/cocos2d/cocos2d-x/pull/3113 . Could you test it ?

dumganhar commented 11 years ago

Now, you need to apply patch in 1) https://github.com/cocos2d/cocos2d-x/pull/3065/files (First Pull Request, not resolved) 2) https://github.com/cocos2d/cocos2d-x/pull/3067/files (Second Pull Request, Resolved) 3) https://github.com/cocos2d/cocos2d-x/pull/3113

Hope it works. :)