Paint program
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Paint program
Yes, but remember; canvases are not an option right now.
All I'm looking for is that the FPS just boosts a little bit more. I'm currently locked at 13 FPS, and I need 25-30. It's not really meant to be a smooth drawing thing, it's meant to have some kind of input lag.
EDIT: FPS shifts from 13-18.
All I'm looking for is that the FPS just boosts a little bit more. I'm currently locked at 13 FPS, and I need 25-30. It's not really meant to be a smooth drawing thing, it's meant to have some kind of input lag.
EDIT: FPS shifts from 13-18.
Code: Select all
L
L Ö
Ö V
L Ö V E
Ö B E
V E
E Y
Re: Paint program
You should definitely try to go with imageData. They reason, why drawing it is faster, is because you only need to call one drawing-function. While for the pixel-by-pixel approach you call a drawing-command for each pixel. Besides the drawing, each function call has some overhead (communication between LÖVE and OpenGL), which makes this approach so slow.
Check out my blog on gamedev
Re: Paint program
Thanks for explaining this to me. I'll try out imageData.micha wrote:Besides the drawing, each function call has some overhead (communication between LÖVE and OpenGL), which makes this approach so slow.
Code: Select all
L
L Ö
Ö V
L Ö V E
Ö B E
V E
E Y
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: Paint program
Maybe something like that:
Code: Select all
pixels={}
function love.update(dt)
if love.mouse.isDown("l") and pixels[mouse.x][mouse.y]==nil then
pixels[mouse.x][mouse.y]=true
end
end
Re: Paint program
Yeah but with that last example you only can draw a pixel once (it's an example, I know, just saying).
Re: Paint program
This is how it is right now (well, something like that). The love.update process isn't what's lagging it, it's the drawing process. Not sure why, someone else says it's because LOVE does an OpenGL thingy every pixel. (480,000)Luke100000 wrote:Maybe something like that:
Code: Select all
pixels={} function love.update(dt) if love.mouse.isDown("l") and pixels[mouse.x][mouse.y]==nil then pixels[mouse.x][mouse.y]=true end end
Oh, and also I added 9 shades and 5 colors to play around with. I kinda like the lagginess, I can make Space Creation Simulator 2013. It might be a bit hard to see the colors, but they're in there. lol
P.S. I went from love.graphics.point(x,y) to love.graphics.rectangle(x,y,1,1) to make brighter pixels.
Code: Select all
L
L Ö
Ö V
L Ö V E
Ö B E
V E
E Y
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: Paint program
If you mean me:tavuntu wrote:Yeah but with that last example you only can draw a pixel once (it's an example, I know, just saying).
you can write:
Code: Select all
pixels={}
function love.update(dt)
if love.mouse.isDown("l") and pixels[mouse.x][mouse.y]==nil then
for x=-5, 5 do
for y=-5, 5 do
pixels[mouse.x+x][mouse.y+y]=true
end
end
end
end
Only circles are the problem.
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: Paint program
That's still drawing every pixel individually. Not in the update function, but in the draw function. And that's what's making it slow. If you had to make a drawing on paper, would you rather make a rectangle by drawing 25 dots, or would you draw 4 lines?
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Paint program
How about every 5 seconds or by adding an array limit to the pixel table the screen gets saved into an ImageData, cleans the pixel table and draws the imageData ?
I'm going to try that.
EDIT: Nah, it re-draws every single pixel anyways :/
EDIT2: Actualy.. It has a limit because calling screenshot on every frame would slow down the FPS. EDIT3: Got a new ideia, everytime the mouse gets released then the current pixels get drawn to the imageData.
EDIT4: And that's paint for you, dunno why it get's alpha'ed every time it takes a screenshot.. That's up to you to fix
I'm going to try that.
EDIT: Nah, it re-draws every single pixel anyways :/
EDIT2: Actualy.. It has a limit because calling screenshot on every frame would slow down the FPS. EDIT3: Got a new ideia, everytime the mouse gets released then the current pixels get drawn to the imageData.
EDIT4: And that's paint for you, dunno why it get's alpha'ed every time it takes a screenshot.. That's up to you to fix
- Attachments
-
- paint.love
- (1022 Bytes) Downloaded 218 times
Re: Paint program
Wow, that's pretty cool! I like the first file you provided, since it's some kind of space creation software. I'll try to learn from that, makes sense. Thanks lots.
Code: Select all
L
L Ö
Ö V
L Ö V E
Ö B E
V E
E Y
Who is online
Users browsing this forum: Bing [Bot], Majestic-12 [Bot], zorg and 3 guests