PhiLho wrote on Dec 29th, 2008, 11:58pm:A possible way to do that is to use the good old sprite trick: you save the area corresponding to the bounding box of the cursor and draw over the image. When you move the cursor, you restore the area (hoping it is fixed!), erasing the old cursor, then repeat.
Actually, I just tried this "sprite" method, and unfortunately, it is painfully slow.
As far as I can tell, if your sketch ever calls "get() or set()", it ends up calling loadPixels()/updatePixels() behind the scenes. This is horribly slow.
My sketch size is 1500x1000, and my sprite is only 16x16. I just want to img=get(x,y,16,16), draw a cursor there, ... and then on the next frame set(x,y,img) to erase my cursor.
As a benchmark, ... my sketch runs at 300 fps without the get/set, but falls to 15 fps when I use get/set, even for a tiny 16x16 sprite.
There should be a way to implement sprites more efficiently, without calling loadPixels/updatePixels for the entire image (1.5 million pixels)!! Is this something that needs to be fixed inside the core of Processing ... or is there something a mere user like me can do
-- djones