Arbitrary scissor shapes?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Arbitrary scissor shapes?

Post by miko »

Robin wrote:How would that be an improvement over using scissor?
It would be an improvement over using mapPixel(). I imagine you could render one part of image to buffer1, another one to buffer2, and then combine them (or put buffer2 over the half of buffer1).
Note: I hope that I am right, I have not tested it.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
genericdave
Citizen
Posts: 53
Joined: Tue Dec 15, 2009 9:08 am

Re: Arbitrary scissor shapes?

Post by genericdave »

It would, in fact, not be an improvement. Everything I'm looking at besides masks are quite limited to aligned rectangles. It looks like we need more flexibility in our alpha compositing options. Namely, we need to be able to alpha mask things without going in and setting each pixel by hand.

I tried something like this just to see how expensive direct pixel access was:

Code: Select all

fb = love.graphics.newFramebuffer(256, 256)
	love.graphics.setRenderTarget(fb)
	love.graphics.rectangle("fill", 100, 100, 100, 100)
	id = fb:getImageData()
	id:mapPixel(function(x,y,r,g,b,a) r = 0 end)
	im = love.graphics.newImage(id)
	love.graphics.draw(im,0,0)
	love.graphics.setRenderTarget()
With hilariously slow results. Alright, I'm going to the issue tracker with this. There seem to be multiple ways to deal with this, but we definitely need it. As it is, you are limited to either drawing something in its entirety or not drawing it at all. No in-betweens. This leaves a whole class of problems as unsolvable.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 194 guests