当前位置:网站首页>cocos2d-x-3.2 image graying effect
cocos2d-x-3.2 image graying effect
2022-07-31 06:01:00 【xuyid】
//dye grey
void GameTools::GrayShaderProgram(Node * node)
{
do{
const GLchar* pszFragSource =
"#ifdef GL_ES \n\
precision mediump float; \n\
#endif \n\
uniform sampler2D u_texture;\n\
varying vec2 v_texCoord; \n\
varying vec4 v_fragmentColor; \n\
void main(void) \n\
{ \n\
// Convert to greyscale usingNTSC weightings \n\
vec4 col = texture2D(u_texture, v_texCoord); \n\
float grey = dot(col.rgb, vec3(0.299, 0.587, 0.114)); \n\
gl_FragColor= vec4(grey, grey, grey, col.a); \n\
}";
GLProgram* pProgram = new GLProgram();
pProgram->initWithByteArrays(
ccPositionTextureColor_noMVP_vert
, pszFragSource);
node->setGLProgram(pProgram);
pProgram->release();
CHECK_GL_ERROR_DEBUG();
node->getGLProgram()->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION);
node->getGLProgram()->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::VERTEX_ATTRIB_COLOR);
node->getGLProgram()->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORD);
CHECK_GL_ERROR_DEBUG();
node->getGLProgram()->link();
CHECK_GL_ERROR_DEBUG();
node->getGLProgram()->updateUniforms();
CHECK_GL_ERROR_DEBUG();
} while (0);
}
边栏推荐
- Access database query
- UiBot存在已打开的MicrosoftEdge浏览器,无法执行安装
- Markdown 帮助文档
- What is an EVM Compatible Chain?
- TransactionTemplate 事务编程式写法
- sql 外键约束【表关系绑定】
- 带你搞懂MySQL隔离级别,两个事务同时操作同一行数据会怎样?
- VS connects to MYSQL through ODBC (1)
- [Elastic-Job source code analysis] - job listener
- Flutter mixed development module dependencies
猜你喜欢

带你搞懂MySQL隔离级别,两个事务同时操作同一行数据会怎样?

The latest MySql installation teaching, very detailed

Chinese garbled solution in UTF-8 environment in Powershell

Gradle sync failed: Uninitialized object exists on backward branch 142

VS通过ODBC连接MYSQL(二)

unicloud 云开发记录

Sqlite column A data is copied to column B

Android software security and reverse analysis reading notes

Notes on creating a new virtual machine in Hyper-V

微信小程序源码获取与反编译方式
随机推荐
Why does read in bash need to cooperate with while to read the contents of /dev/stdin
浅谈对分布式模式下CAP的理解
What is an EVM Compatible Chain?
TransactionTemplate 事务编程式写法
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
Pure shell implementation of text replacement
Chinese garbled solution in UTF-8 environment in Powershell
著名网站msdn.itellyou.cn原理分析
Understanding of js arrays
cocoscreator3.5.2打包微信小游戏发布到QQ小游戏修改
VS通过ODBC连接MYSQL(一)
qt:cannot open C:\Users\某某某\AppData\Local\Temp\main.obj.15576.16.jom for write
cocos2d-x-3.2图片灰化效果
Using IIS10 to build an asp website in win11
[JVM Loading]---Class Loading Mechanism
计网 Packet Tracer仿真 | 简单易懂集线器和交换机对比(理论+仿真)
2021美赛C题M奖思路
Markdown 帮助文档
quick-3.5 无法正常显示有混合纹理的csb文件
场效应管 | N-mos内部结构详解