mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
14 lines
403 B
GDScript
14 lines
403 B
GDScript
extends Spatial
|
|
|
|
func _ready():
|
|
# Clear the viewport.
|
|
var viewport = $Viewport
|
|
$Viewport.set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME)
|
|
|
|
# Let two frames pass to make sure the vieport is captured.
|
|
yield(get_tree(), "idle_frame")
|
|
yield(get_tree(), "idle_frame")
|
|
|
|
# Retrieve the texture and set it to the viewport quad.
|
|
$ViewportQuad.material_override.albedo_texture = viewport.get_texture()
|