setStencil to a circle not clipping quad
Posted: Sun Feb 15, 2015 3:11 am
I’m very new to this so pardon if I make a fundamental error.
The stencil: within an overall rectangle, image based pieces draw over a grid image clipped by a circle.
The grid consists of a background image filling the whole circle, over which quads will be drawn, and hopefully clipped if they go beyond the circular stencil (scope).
maskscreen — a circular texture of the grid (transparent outside) is successfully clipped by the stencil if I draw it off-center, but quad img_apts[7] which is partly outside the stencil isn’t clipped; the whole 29x29 quad is drawn. Why is the stencil failing there?
The stencil: within an overall rectangle, image based pieces draw over a grid image clipped by a circle.
Code: Select all
scope_stencil = function()
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.circle( 'fill', 322.5, 319.5, 611)
end
Code: Select all
function love.draw()
--------------------
love.graphics.draw( mainScreen, 0, 0 ) -- the overall background
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.printf( “Some Text“, 774, 13, 130, "center" )
love.graphics.setColor( 255, 255, 255, 255 )
love.graphics.setStencil( scope_stencil ) -- limit drawing to inside the scope
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw( maskScreen, 17, 14 ) -- 17, 14 = scope center - is clipped to stencil if test drawn out of center
love.graphics.draw( thimage, img_apts[1], 308, 305 ) -- 308, 305 = central grid
love.graphics.draw( thimage, img_apts[7], 48, 152 ) -- is not clipped outside the stencil !!
love.graphics.setStencil()
end