Shader:setConstant
From GiderosMobile
Available since: Gideros 2015.06.30
Class: Shader
Description
Changes the value of a uniform from Lua code.
Shader:setConstant(uniformName,dataType,mult,data)
Parameters
uniformName: (string) the uniform name to change
dataType: (int) the type of data to set (one of the Shader.Cxxx constants)
mult: (number) number of elements of the given type to set
data: (varies) and the actual data to set, either as a table or as multiple arguments
Example
-- loop
local timer = 0
stage:addEventListener(Event.ENTER_FRAME, function(e)
timer += 0.018
shaderwave:setConstant("time", Shader.CFLOAT, 1, timer)
bitmap:setX(bitmap:getX() + 1)
if bitmap:getX() > 400 then bitmap:setX(-80) end
end)