class SFML::RenderTexture

Off-screen rendering target. Anything you can draw on a RenderWindow— sprites, shapes, text, vertex arrays — you can also draw on a RenderTexture and then use its texture as a Sprite source. Typical uses: minimaps, post-processing, motion-blur trails, custom UIs that composite multiple layers.

rt = SFML::RenderTexture.new(400, 300) rt.clear(SFML::Color.cornflower_blue) rt.draw(sprite) rt.draw(text) rt.display

sprite = SFML::Sprite.new(rt.texture) window.draw(sprite)

Note: rt.texture returns a borrowed reference owned by the RenderTexture. Keep the RenderTexture alive for as long as anything uses its texture.