Howdy, Stranger!

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

Problem aplying brick shader

in Questions Posts: 181

I'm trying to apply the brick shader, but it shows black. Texture and color work in the code below, but the shader doesn't. Can anybody spot the problem? I'm drawing it onto an image (so the code below follows a setContext(img)), maybe that's causing problems?

        local m = mesh()
        m:addRect(self.wh.x/2, self.floorHeight/2, self.wh.x, self.floorHeight)
        m.shader = shader("Patterns:Bricks")
        --m.texture = readImage("Cargo Bot:Codea Icon")
        --m:setColors(color(255,0,math.random(255)))
        m:draw()
Tagged:

Comments

  • IgnatzIgnatz Mod
    edited October 2016 Posts: 5,396

    You need to provide parameters to the shader, do this in setup

    --these are the settings from the ShaderLab
    m.shader.brickColor=vec4(0.8,0.8,0.8,1)
    m.shader.mortarColor=vec4(1,.2,.3,1)
    m.shader.brickSize=vec3(35,15,35)
    m.shader.brickPct=vec3(.9,.85,.85)
    
  • Posts: 181

    Ah, excellent! Thanks! =)

Sign In or Register to comment.