Is there something like Canvas:overwriteOldImageData() ?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Is there something like Canvas:overwriteOldImageData() ?
You know you can do it fairly easily just by doing some math, right? Take a look at "shapes" section of this touchscreen library https://github.com/raidho36/love-multitouch it does exactly what you're doing, but without touching the GPU. And it's pretty fast, on account of being designed specifically for mobile, and can even return back the mouse/touch position in local coordinates, even if the element is transformed arbitrarily.
-
- Prole
- Posts: 18
- Joined: Sun Dec 31, 2017 4:04 pm
Re: Is there something like Canvas:overwriteOldImageData() ?
Ok, thanks for the link. However at the moment I want to go neither geometry path nor third-party lib path.raidho36 wrote: ↑Thu Mar 01, 2018 5:23 pm Take a look at "shapes" section of this touchscreen library https://github.com/raidho36/love-multitouch it does exactly what you're doing, but without touching the GPU.
Re: Is there something like Canvas:overwriteOldImageData() ?
As per MIT license, you can take any and all parts of the code and do with them as you see fit.
Anyway as I said originally, you don't need to read any of the pixels from GPU back to RAM, that's just unnecessary waste of performance. There's no such scenario where this approach outperforms basic geometry hit testing, simply due to GPU calls overhead.
As a final note, there's a saying "faster computational hardware is offset by programmers that write slower software". It exists for this very reason. Don't be that programmer.
Anyway as I said originally, you don't need to read any of the pixels from GPU back to RAM, that's just unnecessary waste of performance. There's no such scenario where this approach outperforms basic geometry hit testing, simply due to GPU calls overhead.
As a final note, there's a saying "faster computational hardware is offset by programmers that write slower software". It exists for this very reason. Don't be that programmer.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests