Spout.receiver:receiveTexture

From GiderosMobile
Revision as of 00:53, 13 November 2026 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2018.6.3
Class: Spout

Description

Copies the sender's current frame into a texture. Call it once per frame.

(bool), (string), (number), (number) = receiver:receiveTexture(texture, name)

Call it from Event.ENTER_FRAME. A frame is only copied when the name, the size and the format match the sender the receiver is already connected to.

When the sender appears, changes name, changes size or changes format, Spout re-initialises and this call returns true without copying a frame, reporting the new name and size so the caller can adjust its texture.

Always store the returned name and rebuild the receiving texture when the size changes, otherwise the picture stays frozen while the call keeps succeeding.

Parameters

texture: (TextureBase) the texture the frame is copied into, usually a RenderTarget. It must be the sender's size
name: (string) the sender to receive from, normally the name returned by the previous call

Return values

Returns (boolean) true when the receiver is connected to a sender
Returns (string) the name of the connected sender
Returns (number) the sender width
Returns (number) the sender height