Image:refresh and Image:replacePixels in 0.11

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Posts: 68
Joined: Fri Jun 20, 2014 1:33 pm

Image:refresh and Image:replacePixels in 0.11

Post by MachineCode » Sat Jan 13, 2018 5:44 am

I am working on a pixel drawing engine that uses 16bit instructions to draw stuff on an imageData which then updates the image in VRAM for drawing on the screen. A lot of the drawing could be done on a canvas, however using mapPixel to change colors and similar pixel operations would need some tricky shader coding to replace them on the canvas. Yes, I know the update penalty for RAM->VRAM and I test love code on a Raspberry pi 3 to check viability (if it runs on a 1.2Ghz ARM then it should run on anything). Also, drawing in RAM it should be possible to put that bitmap drawing code in a separate thread which will help.

OK, so I was planning to use Image:refresh( x, y, width, height ) to only update the parts of the Image that are changed/visible. In 0.11 refresh is now Image:replacePixels(), so I asked on discord why the partial refresh was not supported in 0.11? slime told me that
Image:refresh( x, y, width, height ) never worked properly - as opengl does not support this very well. I wrote some code to actually test this and what he said is true! Image:refresh( x, y, width, height ) only works if width is the full width of of the image and x=0. Checked on debian with nvidia and also RPi3 with opengl driver and got the same result. So, you can use refresh with parameters as long as you specify full width horizontal slices. Not sure if windows behaves the same as linux.

So, 0.10.2 is almost dead and 0.11 is soon so it doesn't matter much, however I would have thought someone tried to use Image:refresh( x, y, width, height ) and found this. mapPixel(fn,x,y,w,h) works well, so I would think that having a pixel map image of little tiles that you can selectively do color effects on and then refresh to an image would happen a lot in love programs. This is the first time I have seen any love feature that doesn't work as per the wiki, so I am wondering if i am missing something.

Post Reply

Who is online

Users browsing this forum: Charlie Gallie, Google [Bot], keharriso, Nelvin and 16 guests