core.shader.create

Client

Creates a new shader instance by loading GLSL source from a file path


Syntax

local instance = core.shader.create(
    path,
    mode
)

Parameters

TypeNameDescription
stringpathFile path to a GLSL shader asset
core.shader.shader_modemodeRendering pipeline to target

Returns

TypeNameDescription
shaderinstanceCreated shader instance

Examples

Load a canvas-item shader from a file
local entity = core.shader.create("assets/shaders/ripple.glsl", core.shader.shader_mode.CANVAS_ITEM)

util.event.on("sandbox:draw", function()
    core.engine.draw_material(
        {0, 0}, 
        core.engine.get_resolution(), 
        entity
    )
end)

On this page