{"action":"created","issue":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10793","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10793/labels{/name}","comments_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10793/comments","events_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10793/events","html_url":"https://github.com/cocos2d/cocos2d-x/issues/10793","id":60463132,"number":10793,"title":"How to make setOpacity and setBlendFunc effectively at the same time?","user":{"login":"fusijie","id":5085300,"avatar_url":"https://avatars.githubusercontent.com/u/5085300?v=3","gravatar_id":"","url":"https://api.github.com/users/fusijie","html_url":"https://github.com/fusijie","followers_url":"https://api.github.com/users/fusijie/followers","following_url":"https://api.github.com/users/fusijie/following{/other_user}","gists_url":"https://api.github.com/users/fusijie/gists{/gist_id}","starred_url":"https://api.github.com/users/fusijie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusijie/subscriptions","organizations_url":"https://api.github.com/users/fusijie/orgs","repos_url":"https://api.github.com/users/fusijie/repos","events_url":"https://api.github.com/users/fusijie/events{/privacy}","received_events_url":"https://api.github.com/users/fusijie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/labels/module:core","name":"module:core","color":"207de5"},{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/labels/type:refine","name":"type:refine","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"fusijie","id":5085300,"avatar_url":"https://avatars.githubusercontent.com/u/5085300?v=3","gravatar_id":"","url":"https://api.github.com/users/fusijie","html_url":"https://github.com/fusijie","followers_url":"https://api.github.com/users/fusijie/followers","following_url":"https://api.github.com/users/fusijie/following{/other_user}","gists_url":"https://api.github.com/users/fusijie/gists{/gist_id}","starred_url":"https://api.github.com/users/fusijie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusijie/subscriptions","organizations_url":"https://api.github.com/users/fusijie/orgs","repos_url":"https://api.github.com/users/fusijie/repos","events_url":"https://api.github.com/users/fusijie/events{/privacy}","received_events_url":"https://api.github.com/users/fusijie/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/milestones/21","html_url":"https://github.com/cocos2d/cocos2d-x/milestones/v3.8","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-x/milestones/21/labels","id":1080167,"number":21,"title":"v3.8","description":"This version is planned to only \"fix existing bugs\" and \"unfinished tasks\".\r\nWe need to improve the quality after a 3D rush in v3.6 and v3.7. ","creator":{"login":"walzer","id":345379,"avatar_url":"https://avatars.githubusercontent.com/u/345379?v=3","gravatar_id":"","url":"https://api.github.com/users/walzer","html_url":"https://github.com/walzer","followers_url":"https://api.github.com/users/walzer/followers","following_url":"https://api.github.com/users/walzer/following{/other_user}","gists_url":"https://api.github.com/users/walzer/gists{/gist_id}","starred_url":"https://api.github.com/users/walzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/walzer/subscriptions","organizations_url":"https://api.github.com/users/walzer/orgs","repos_url":"https://api.github.com/users/walzer/repos","events_url":"https://api.github.com/users/walzer/events{/privacy}","received_events_url":"https://api.github.com/users/walzer/received_events","type":"User","site_admin":false},"open_issues":149,"closed_issues":38,"state":"open","created_at":"2015-04-23T07:50:39Z","updated_at":"2015-07-09T07:41:03Z","due_on":"2015-07-30T16:00:00Z","closed_at":null},"comments":1,"created_at":"2015-03-10T07:58:05Z","updated_at":"2015-07-09T07:56:05Z","closed_at":null,"body":"`version: ` 3.4Final\r\n`issue: ` the same code have different effect in v2.2.6 and v3.4. How to make setOpacity and setBlendFunc effectively at the same time?\r\n`reproduce: ` add following code to HelloWorld project.\r\n`v3.4: ` setOpacity(0) has no effect.\r\n```cpp\r\n    sprite->setOpacity(0);\r\n    BlendFunc bf;\r\n    bf.src = GL_ONE;\r\n    bf.dst = GL_ONE;\r\n    sprite->setBlendFunc(bf);\r\n```\r\n`v2.2.6: ` setOpacity(0) has right effect.\r\n```cpp\r\n    pSprite->setOpacity(0);\r\n    ccBlendFunc bf;\r\n    bf.src=GL_ONE;\r\n    bf.src=GL_ONE;\r\n    pSprite->setBlendFunc(bf);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/comments/119862389","html_url":"https://github.com/cocos2d/cocos2d-x/issues/10793#issuecomment-119862389","issue_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10793","id":119862389,"user":{"login":"fusijie","id":5085300,"avatar_url":"https://avatars.githubusercontent.com/u/5085300?v=3","gravatar_id":"","url":"https://api.github.com/users/fusijie","html_url":"https://github.com/fusijie","followers_url":"https://api.github.com/users/fusijie/followers","following_url":"https://api.github.com/users/fusijie/following{/other_user}","gists_url":"https://api.github.com/users/fusijie/gists{/gist_id}","starred_url":"https://api.github.com/users/fusijie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusijie/subscriptions","organizations_url":"https://api.github.com/users/fusijie/orgs","repos_url":"https://api.github.com/users/fusijie/repos","events_url":"https://api.github.com/users/fusijie/events{/privacy}","received_events_url":"https://api.github.com/users/fusijie/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T07:56:05Z","updated_at":"2015-07-09T07:56:05Z","body":"This issue only appear on the Mac platform. And on the contrary, v3.x has the right effect, v2.x has the wrong effect.\r\n``` cpp\r\n    sprite->setOpacity(0);\r\n```\r\nThe above code make sprite alpha value to zero, so any vertices color of the sprite is (r, g, b, 0).It means source color vector is (r, g, b, 0.0f). The destination color is glClearColor(now is BLACK), (0.0f, 0.0f, 0.0f ,1.0f).\r\n\r\nSo according to the BlendFuc({GL_ONE, GL_ONE}), the final color is \r\n``` cpp\r\n   final color vector  =  source color vector + destination color vector = (r, g, b, 1.0f)\r\n```\r\nIt lead to setOpacity(0) has no effect.\r\n\r\nSo now the issue is BlendFuc abnormal on the Mac platform in v2.2.6."}}