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)

 

转载于:https://www.cnblogs.com/gamesky/p/10123359.html

你可能感兴趣的:(cocos中lua使用shader实例)