self:set_param_texture

Client

Binds an image instance to a sampler uniform on the shader


Syntax

local status = self:set_param_texture(
    name,
    texture
)

Parameters

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

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Bind a texture to a canvas-item shader
local entity = core.shader.create("assets/shaders/distort.glsl", core.shader.shader_mode.CANVAS_ITEM)
local image = core.image.create("assets/textures/noise.png")

entity:set_param_texture("noise_tex", image)
Bind a diffuse map to a spatial shader
local entity = core.shader.create("assets/shaders/pbr_custom.glsl", core.shader.shader_mode.SPATIAL)
local diffuse = core.image.create("assets/materials/rock_diffuse.png")

entity:set_param_texture("albedo_tex", diffuse)

On this page