Display
core.display.get_texture
ClientRetrieves the display texture of the main viewport
Syntax
local instance = core.display.get_texture(
last_frame = false
)The live viewport cannot be sampled while it is being rendered.
- Live viewport —
last_frame = falsereferences the main viewport directly. - Previous frame —
last_frame = truereferences a copy of the last rendered frame; use it as a shader input such as inself:set_param.
Parameters
| Type | Name | Description |
|---|---|---|
bool | last_frame | Whether to retrieve the copy of the previously rendered frame instead of the live viewport |
Returns
| Type | Name | Description |
|---|---|---|
display | instance | Display texture instance, reused when one with the same last_frame mode already exists |
Examples
local display = core.display.get_texture()
core.engine.print("info", display:get_type()) -- "core.display"local shader = core.shader.create("assets/shaders/blur.glsl", core.shader.shader_mode.CANVAS_ITEM)
local display = core.display.get_texture(true)
shader:set_param("screen_texture", display)