local blur = Shader.new("Vertex", "fBlur", 0, {
{name="vMatrix", type=Shader.CMATRIX, sys=Shader.SYS_WVP, vertex=true},
{name="fColor", type=Shader.CFLOAT4, sys=Shader.SYS_COLOR, vertex=false},
{name="fTexture", type=Shader.CTEXTURE, vertex=false},
{name="fDir", type=Shader.CFLOAT2, vertex=false},
{name="fResolution", type=Shader.CFLOAT2, vertex=false},
}, {
{name="vVertex", type=Shader.DFLOAT, mult=3, slot=0, offset=0},
{name="vColor", type=Shader.DUBYTE, mult=4, slot=1, offset=0},
{name="vTexCoord", type=Shader.DFLOAT, mult=2, slot=2, offset=0},
}
)
local texture = Texture.new("image.png")
local tw = texture:getWidth()
local th = texture:getHeight()
stage:addChild(Pixel.new(0xff00ff, 1, tw, th)) -- bg image
local image = Bitmap.new(texture)
local rt = RenderTarget.new(tw, th)
rt:draw(image)
local render = Bitmap.new(rt)
-- does NOT work ???
render:setEffectStack{{buffer = rt, shader = blur}}
render:setEffectConstant(1, "fDir", Shader.CFLOAT2, 1, 1,0)
render:setEffectConstant(1, "fResolution", Shader.CFLOAT2, 1, 512,512)
stage:addChild(render)
Comments
Ive pushed a fix for that: https://github.com/gideros/gideros/pull/514/commits/3bd54dda315c1ab31f17797cf4757d3560c65ca3#diff-83af4f9bcedb447120fad0cd1d93c9fbd773ea79041e7fad6f84db0b142c4767R246
Likes: keszegh, MoKaLux