LÖVE

Grab part of screen, draw, replace

Grab part of screen, draw, replace

Posted: Wed Feb 21, 2018 5:18 pm

by mr_happy

I'm sure I've done this before, but I haven't done any coding of late and can't recall how to go about it:

I need to copy part of the back-buffer (or whatever its called these days), draw some stuff on it then copy it back to the screen before it's displayed. The part being copied, drawn to then copied back, is of constant size so doesn't need to be created on the fly. What's the quickest way to do this?

In other libraries I've used it would be a case of creating a new image, copying a quad to it from the back-buffer, setting it as the draw target, drawing then copying it back. I'm getting lost in canvases and imagedata on the wiki! No code example required, just a nudge in the right direction would be great.

TIA

Re: Grab part of screen, draw, replace

Posted: Wed Feb 21, 2018 6:55 pm

by raidho36

You can draw to an intermediate render target, then perform manipulations with it, and finally put it on the screen.