Difference between revisions of "Framebuffer:renderTo"

Line 14: Line 14:
  
 
== Notes ==
 
== Notes ==
 +
This function will clear the target framebuffer.
 +
 
This is a shortcut to [[love.graphics.setRenderTarget]]:
 
This is a shortcut to [[love.graphics.setRenderTarget]]:
 
<source lang="lua">
 
<source lang="lua">
Line 24: Line 26:
 
love.graphics.setRenderTarget()
 
love.graphics.setRenderTarget()
 
</source>
 
</source>
 
This function will clear the target framebuffer.
 
  
 
== Examples ==
 
== Examples ==

Revision as of 18:49, 8 December 2010

Available since LÖVE 0.7.0
This function is not supported in earlier versions.


Render to the Framebuffer using a function.

Function

Synopsis

Framebuffer:renderTo( func )

Arguments

function func
A function performing drawing operations.

Returns

Nothing.

Notes

This function will clear the target framebuffer.

This is a shortcut to love.graphics.setRenderTarget:

framebuffer:renderTo( func )

is the same as

love.graphics.setRenderTarget( framebuffer )
func()
love.graphics.setRenderTarget()

Examples

Using an anonymous function for drawing to a Framebuffer

framebuffer:renderTo(function()
    love.graphics.draw(image1, 0,0)
    love.graphics.draw(image2, 100,100)
end)

See Also

Other Languages