love.graphics.present() + dirty rects?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
love.graphics.present() + dirty rects?
I've read in the wiki that in the love 0.6.0 version we'll be able to rewrite the main loop... So... Could we use the love.graphics.present() function to draw only a part of the screen, using the so called dirty rects technique?
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: love.graphics.present() + dirty rects?
Where can I find an explanation on dirty rectangles?
Re: love.graphics.present() + dirty rects?
http://www.gamedev.net/dict/term.asp?TermID=501
A method of updating only the changed parts of the screen. The screen is divided up into rectangles and only rectangles that have changes are makred "dirty" and then are redrawn to clean them up. Increases drawing speed as less is drawn.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: love.graphics.present() + dirty rects?
I guess this would be utilizing 0.6.0's frames.
Re: love.graphics.present() + dirty rects?
it'd be good if something like this could be handled by the engine. perhaps you'd enable it in the config file or something like that
Re: love.graphics.present() + dirty rects?
Yes, i think Frames would help, but with love.graphics.present() the entire screen will always be redrawn every frame. If we could pass a list of rectangles to the function so that other parts of the screen not included in the list won't be redrawn, we could speed up 2d games a bit... For example: If in a 2d tile based game without map scrolling i move the player by one tile down, instead of redrawing the entire screen, i would pass to the function only a rect including 2 tiles: the origin of the movement and the arrival.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: love.graphics.present() + dirty rects?
I think this is what you are looking for?
Version 0.6.0
Version 0.6.0
Also planned are FrameBuffers.
fb = love.graphics.newFrameBuffer( width, height )
love.graphics.setFrameBuffer( fb )
love.graphics.draw( image, x, y ) -- draws into fb.
love.graphics.setFrameBuffer() -- Change back to screen.
love.graphics.draw( fb, 0, 0, 0, 2, 2) -- Draw the framebuffer to the screen (scaled).
Further, we have Frames:
frame = love.graphics.newFrame( image, x, y, w, h )
love.graphics.draw( frame, x, y, angle, sx, sy, ox, oy )
-- API:
frame = love.graphics.newFrame( image ) -- Entire image (not directly useful).
frame = love.graphics.newFrame( image, x, y, w, h ) -- Part of image.
frame = love.graphics.newFrame( image, s0,t0,s1,t1,s2,t2,s3,t3 ) -- Custom texels entire image.
frame = love.graphics.newFrame( image, x, y, w, h, s0,t0,s1,t1,s2,t2,s3,t3 ) -- Custom texels part of image.
frame:flip( x, y ) -- Flips the frame horizontally (x=true) and/or vertically (y=true)
love.graphics.draw(frame, x, y, angle, sx, sy, ox, oy)
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: love.graphics.present() + dirty rects?
About that: frames were renamed to quads.
Re: love.graphics.present() + dirty rects?
Just avoid love.graphics.clear, and overwrite the area you want to update each frame.
Re: love.graphics.present() + dirty rects?
what kind of preformace boost are you getting using frames + quads?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest