cocos shader 之 黑白滤镜

cocos shader 之 黑白滤镜,第1张

概述效果: VSH: #ifdef OPENGL_ESprecision mediump vec2;precision mediump float;#endif// Attributesattribute vec3 a_position;attribute vec2 a_texCoord;attribute vec4 a_color;// Varyings#ifdef GL_ES

效果:


VSH:

#ifdef OPENGL_ESprecision mediump vec2;precision mediump float;#endif// Attributesattribute vec3 a_position;attribute vec2 a_texCoord;attribute vec4 a_color;// varyings#ifdef GL_ESvarying vec2 v_texCoord;#elsevarying vec2 v_texCoord;#endifvarying vec4 v_fragmentcolor;voID main(){    gl_position = CC_PMatrix * vec4(a_position,1.0);    v_texCoord = a_texCoord;    v_fragmentcolor = a_color;}

FSH:
#ifdef GL_ESprecision mediump float;#endifvarying vec2 v_texCoord;varying vec4 v_fragmentcolor;voID main() {    vec4 col = texture2D(CC_Texture0,v_texCoord );    float h = dot(col.rgb,vec3(0.3,0.59,0.21));	gl_Fragcolor = vec4(h,h,col.a);}
总结

以上是内存溢出为你收集整理的cocos shader 之 黑白滤镜全部内容,希望文章能够帮你解决cocos shader 之 黑白滤镜所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1072029.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存