Drawing a large number of individual pixels per frame

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.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: Drawing a large number of individual pixels per frame

Post by tsturzl »

This wouldn't draw it any faster, but you could see it calculated in real time. Use threading to make a thread that draws the map out, and as you go you can see the progress, and this can all be done without sacrificing FPS because all the processing is done outside the main loop.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Drawing a large number of individual pixels per frame

Post by slime »

tsturzl wrote:This wouldn't draw it any faster, but you could see it calculated in real time. Use threading to make a thread that draws the map out, and as you go you can see the progress, and this can all be done without sacrificing FPS because all the processing is done outside the main loop.
Having any sort of draw calls in another thread is a really bad idea in LÖVE, if that's what you're suggesting.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Drawing a large number of individual pixels per frame

Post by miko »

kefka wrote: So far its looking like to me like the best way to go about doing this would be maintaining an ImageData object and calling setPixel when i want to update a tile coordinate?

Thoughts?
You could speed it up by setting more than one pixel at once. For example, if you know that some rectangle area (or a line, which is a rectangle with width/height of 1 pixel) will have the same color, you could use ImageData:paste().
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Drawing a large number of individual pixels per frame

Post by T-Bone »

The main issue here is really that drawing a large number of individual pixels per frame is a bad idea in itself :neko:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests