cocos2dx系列--颜色混合BlendFunc
来源:互联网 发布:ipad版淘宝没有微淘 编辑:程序博客网 时间:2024/05/21 22:22
struct CC_DLL BlendFunc{ //! source blend function GLenum src; //! destination blend function GLenum dst; //! Blending disabled. Uses {GL_ONE, GL_ZERO} static const BlendFunc DISABLE; //! Blending enabled for textures with Alpha premultiplied. Uses {GL_ONE, GL_ONE_MINUS_SRC_ALPHA} static const BlendFunc ALPHA_PREMULTIPLIED; //! Blending enabled for textures with Alpha NON premultiplied. Uses {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA} static const BlendFunc ALPHA_NON_PREMULTIPLIED; //! Enables Additive blending. Uses {GL_SRC_ALPHA, GL_ONE} static const BlendFunc ADDITIVE; bool operator==(const BlendFunc &a) const { return src == a.src && dst == a.dst; } bool operator!=(const BlendFunc &a) const { return src != a.src || dst != a.dst; } bool operator<(const BlendFunc &a) const { return src < a.src || (src == a.src && dst < a.dst); }};代码测试如下:
//test 1Sprite* sp1 = Sprite::create("my_test/red.png");sp1->setPosition(Vec2(200, 200));addChild(sp1);Sprite* sp2 = Sprite::create("my_test/green.png");sp2->setPosition(Vec2(220,220));this->addChild(sp2);BlendFunc cbl = { GL_SRC_ALPHA , GL_ONE };sp2->setBlendFunc(cbl);//test 2Sprite* sp3 = Sprite::create("my_test/red.png");sp3->setPosition(Vec2(300, 200));addChild(sp3);Sprite* sp4 = Sprite::create("my_test/green.png");sp4->setPosition(Vec2(320,220));this->addChild(sp4);BlendFunc cb2 = {GL_ZERO, GL_ONE};sp4->setBlendFunc(cb2);//test 3Sprite* sp5 = Sprite::create("my_test/red.png");sp5->setPosition(Vec2(400, 200));addChild(sp5);Sprite* sp6 = Sprite::create("my_test/green.png");sp6->setPosition(Vec2(420,220));this->addChild(sp6);sp6->setBlendFunc(BlendFunc::DISABLE);
测试结果如下:
1 0
- cocos2dx系列--颜色混合BlendFunc
- cocos2dx[3.2](15)——颜色混合BlendFunc
- BlendFunc颜色混合
- 颜色混合BlendFunc用法实例总结
- 颜色混合BlendFunc用法实例总结
- Cocos2d-x3.3的的颜色混合BlendFunc
- Cocos2d-x v3.3的颜色混合BlendFunc
- cocos2dx中的颜色混合
- Cocos2d-x v3.X的颜色混合BlendFunc使用详解
- Cocos2d-x v3.X的颜色混合BlendFunc使用详解
- opengl入门系列- 颜色混合
- cocos2dx Sprite setBlendFunc 使用颜色混合:加算,减算
- cocos2dx Sprite setBlendFunc 使用颜色混合:加算,减算
- 颜色混合
- Cocos2dx BlendFunc以及用其来实现裁切出不同形状的精灵
- Cocos2dx BlendFunc以及用其来实现裁切出不同形状的精灵
- osg::BlendFunc
- cocos2dx 系列教程
- Installing Python3.4 and the SciPy stack on CentOS
- 正则表达式---简化字符串操作
- HDU 2196 Computer(树的直径)
- viewpager最后一个view滑动开启另一个activity等的方法
- mysql 备份(直接拷贝数据文件)仅限myisam数据库可以
- cocos2dx系列--颜色混合BlendFunc
- JSOI2015 Round2 Day2题解
- Spring 对hibernate事务处理的实现过程(2) spring怎么获取hibernate使用的session并开启事务的
- 装船问题
- SP5000系列烧录器大小端转换C语言实现
- 资源
- 笔试题11. 你是对称二叉树吗?
- hdu2594 Simpsons’ Hidden Talents (kmp)
- C++实践参考:IP地址类