当前位置:网站首页>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);
}
边栏推荐
- Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?
- [Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version
- 【云原生】微服务Nacos的简单介绍与使用
- VS2017连接MYSQL
- 场效应管 | N-mos内部结构详解
- [swagger close] The production environment closes the swagger method
- 数据库 | SQL增删改查基础语法
- sql add default constraint
- [uiautomation] Get WeChat friend list (stored in txt)
- [Cloud Native] What should I do if SQL (and stored procedures) run too slowly?
猜你喜欢
![[Cloud native] Open source data analysis SPL easily copes with T+0](/img/89/4a96358956782ef9dacf0b700b54c3.png)
[Cloud native] Open source data analysis SPL easily copes with T+0

Android software security and reverse analysis reading notes

WeChat applet source code acquisition and decompilation method

DeFi Token in the project management

浏览器查找js绑定或者监听的事件
![[Cloud native] Simple introduction and use of microservice Nacos](/img/06/b0594208d5b0cbf3ae8edd80ec12c4.png)
[Cloud native] Simple introduction and use of microservice Nacos

自定dialog 布局没有居中解决方案

unicloud 发布后小程序提示连接本地调试服务失败,请检查客户端是否和主机在同一局域网下
![[Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version](/img/7e/1d27e3f1856ab8c6cbfc5221c717bb.png)
[Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version

This in js points to the prototype object
随机推荐
cocos2d-x-3.2 不能混合颜色修改
configure:error no SDL library found
flutter 混合开发 module 依赖
What is an EVM Compatible Chain?
一个简单的bash转powershell案例
浅谈对分布式模式下CAP的理解
js中的this指向与原型对象
Flow control statement in js
自定dialog 布局没有居中解决方案
flutter arr 依赖
Using IIS10 to build an asp website in win11
Year-end summary - the years are quiet~
quick lua加密
cocos2d-x-3.x 修改和纪录
腾讯云轻量服务器删除所有防火墙规则
sql add default constraint
Tencent Cloud GPU Desktop Server Driver Installation
Global scope and function scope in js
Attribute Changer的几种形态
MySQL分页查询的5种方法