self:set_param_rt

Client

Binds a rendertarget instance to a sampler uniform on the shader


Syntax

local status = self:set_param_rt(
    name,
    rendertarget
)

Parameters

TypeNameDescription
stringnameName of the sampler uniform as declared in the GLSL source
rendertargetrendertargetRendertarget instance to bind

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Bind a rendertarget to a post-process shader
local entity = core.shader.create("assets/shaders/postfx.glsl", core.shader.shader_mode.CANVAS_ITEM)
local rendertarget = core.rendertarget.create({1920, 1080})

entity:set_param_rt("screen_tex", rendertarget)
Pipe a rendertarget into a spatial shader for screen-space effects
local entity = core.shader.create("assets/shaders/reflection.glsl", core.shader.shader_mode.SPATIAL)
local rendertarget = core.rendertarget.create({512, 512})

entity:set_param_rt("reflection_tex", rendertarget)

On this page