Difference between revisions of "love.graphics.setRenderTarget"

(Added newin template)
m
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{newin|[[0.7.0]]}}
+
{{newinoldin|[[0.7.0]]|070|[[0.8.0]]|080|type=function|text=It has been renamed to [[love.graphics.setCanvas]]}}
 
 
 
Sets or resets a [[Framebuffer]] as render target. All drawing operations until the next ''love.graphics.setRenderTarget'' will be directed to the [[Framebuffer]] object specified.
 
Sets or resets a [[Framebuffer]] as render target. All drawing operations until the next ''love.graphics.setRenderTarget'' will be directed to the [[Framebuffer]] object specified.
  
Line 13: Line 12:
 
Nothing.
 
Nothing.
 
=== Notes ===
 
=== Notes ===
Sets the render target to a specified [[Framebuffer]]. All drawing operations until the next ''love.graphics.setRenderTarget'' will be redirected to the [[Framebuffer]] and not shown on the screen.
+
Sets the render target to a specified [[Framebuffer]]. The specified [[Framebuffer]] will be cleared. All drawing operations until the next ''love.graphics.setRenderTarget'' will be redirected to the [[Framebuffer]] and not shown on the screen.
  
 
== Function ==
 
== Function ==
Line 26: Line 25:
 
=== Notes ===
 
=== Notes ===
 
Resets the render target to the screen, i.e. re-enables drawing to the screen.
 
Resets the render target to the screen, i.e. re-enables drawing to the screen.
 +
  
  
 
== Examples ==
 
== Examples ==
 +
=== Drawing to a framebuffer ===
 +
<source lang="lua">
 +
-- draw colored square to framebuffer
 +
love.graphics.setRenderTarget(framebuffer)
 +
love.graphics.setColor(230,240,120)
 +
love.graphics.rectangle('fill',0,0,100,100)
 +
love.graphics.setRenderTarget()
 +
 +
-- draw scaled framebuffer to screen
 +
love.graphics.setColor(255,255,255)
 +
love.graphics.draw(framebuffer, 200,100, 0, .5,.5)
 +
</source>
 +
 +
== See Also ==
 +
* [[parent::love.graphics]]
 +
* [[Framebuffer]]
 +
* [[Framebuffer:renderTo]]
 +
[[Category:Functions]]
 +
{{#set:Description=Captures drawing operations to a Framebuffer}}
 +
{{#set:Sub-Category=State}}
 +
 +
== Other Languages ==
 +
{{i18n|love.graphics.setRenderTarget}}

Latest revision as of 19:02, 27 December 2015

Available since LÖVE 0.7.0 and removed in LÖVE 0.8.0
It has been renamed to love.graphics.setCanvas.

Sets or resets a Framebuffer as render target. All drawing operations until the next love.graphics.setRenderTarget will be directed to the Framebuffer object specified.

Function

Synopsis

love.graphics.setRenderTarget( framebuffer )

Arguments

Framebuffer framebuffer
The new render target.

Returns

Nothing.

Notes

Sets the render target to a specified Framebuffer. The specified Framebuffer will be cleared. All drawing operations until the next love.graphics.setRenderTarget will be redirected to the Framebuffer and not shown on the screen.

Function

Synopsis

love.graphics.setRenderTarget( )

Arguments

None.

Returns

Nothing.

Notes

Resets the render target to the screen, i.e. re-enables drawing to the screen.


Examples

Drawing to a framebuffer

-- draw colored square to framebuffer
love.graphics.setRenderTarget(framebuffer)
love.graphics.setColor(230,240,120)
love.graphics.rectangle('fill',0,0,100,100)
love.graphics.setRenderTarget()

-- draw scaled framebuffer to screen
love.graphics.setColor(255,255,255)
love.graphics.draw(framebuffer, 200,100, 0, .5,.5)

See Also


Other Languages