Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do you use filters and get them to show?

edited February 2013 in General Posts: 3

I've tried searching the reference guides and experimenting with the shader() but to no avail I cant get the filters to show up.

I can pick them from the picker but I never see them in action outside of the editor when its in action, you know when the program is running. When the program is running? Its no where to be seen?

How do I get the filters effects to show?

Tagged:

Comments

  • Posts: 489

    Hello @valleyhal. Does the following example help?

    function setup()
        parameter.integer("numColors", 1, 16, 3)
        m = mesh()
        local idx = m:addRect(WIDTH/2, HEIGHT/2, WIDTH, WIDTH)
        m:setRectTex(idx, 0, 1, 1, -1)
        m.texture = readImage("Cargo Bot:Codea Icon")
        m.shader = shader("Filters:Posterize")
        m.shader.gamma = 1
        fill(255)
    end
    
    function draw()
        background(0)
        m.shader.numColors = numColors
        m:draw()
    end
    
  • .@mpilgrem Thanks m

    So, basically you have to have look under the filter's bindings tab to see what you need and then re-implement(and possibly redefine) them in code or else they won't show.

  • Exactly, the shaders when they fail, basically just do nothing, they don't stop the app. So if the shader is not working it either has bad code internally or you haven't fed in the stuff in the bindings.

    In the shader lab you can put stuff in the bindings to test it, but these are not used as default values or anything in operation, you have to set them all yourself with mesh.shader.xxx = whatever type statements.

Sign In or Register to comment.