Codea GLSL is it LuaGL or moonGL?

I’ve been wanting to put the right GLSL software on my laptop because I didn’t see a feature were you can edit the shader through air code??

Codea uses GLSL. You can write shaders through Air Code but you’ll have to inline them in your Lua code as multi-line strings. Something like:

-- InlineShader

function setup()
    local vert = [[
    uniform mat4 modelViewProjection;

    attribute vec4 position;
    attribute vec4 color;
    attribute vec2 texCoord;
    
    varying lowp vec4 vColor;
    varying highp vec2 vTexCoord;
    
    void main()
    {
        vColor = color;
        vTexCoord = texCoord;
        gl_Position = modelViewProjection * position;
    }
    ]]
    local frag = [[
    precision highp float;
    uniform lowp sampler2D texture;
    varying lowp vec4 vColor;
    varying highp vec2 vTexCoord;
    
    void main()
    {
        lowp vec4 col = texture2D( texture, vTexCoord ) * vColor;    
        gl_FragColor = vec4( (1.0 - col.rgb) * col.a, col.a );
    }    
    ]]
    
    local inlineShader = shader(vert, frag)
    
    inlineShader.texture = readImage(asset.builtin.Planet_Cute.Gem_Green)
    
    myMesh = mesh()
    myMesh:addRect(0, 0, 200, 300)
    myMesh.shader = inlineShader
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

    translate(WIDTH/2, HEIGHT/2)
    
    myMesh:draw()
end
1 Like

Thank you this is a big help.:+1::+1::+1: