cocos中lua使用shader实例

local prog = cc.GLProgram:create("res/shader/light2d.vsh","res/shader/light2d.fsh")
prog:link()
prog:updateUniforms()
local progStat= cc.GLProgramState:create(prog)

progStat:setUniformVec2("u_lightPosition",cc.p(GVar.halfWinW,GVar.halfWinH))
progStat:setUniformVec4("u_lightColor",cc.vec4(1,1,1,1))
progStat:setUniformFloat("u_lightRange",100)


playerImg:setGLProgram(prog)
playerImg:setGLProgramState(progStat)

 

posted @ 2018-12-15 14:43  冷夜 - 网游编程技术  阅读(685)  评论(0编辑  收藏  举报