Hi,
I'd like to experiment with a code that needs to go pixel by pixel and do some additional calculations. Now the area could be (most of the time) greatly reduced by accessing only pixels of a newly drawn shape (before I actually draw it).
I thought it could be nice to use stencils for that, however I have no way to access the data to determine which pixels I really need to check.
I thought of drawing (not necessarily) stencils to a Canvas and then reading the data without displaying anything, howewer that would involve (to my best knowledge) Canvas:newImageData(), which the wiki says to be slow, and then reading the ImageData. And since Canvas:getPixel() is removed, there seems to be no other legit way to read Canvas data.
This, on the other hand, needs to be lightning fast (which seems hard when dealing with pixel to pixel, but I chose to ignore this fact for time being).
Of course I could use my own math for the shapes, but why not exploit the built-ins...
Thanks.
Access stencil data
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Access stencil data
Last edited by IsawU on Fri Jul 28, 2017 4:02 pm, edited 1 time in total.
Re: Access stencil data
You can use Shaders I guess; I don't think I can help much more unless you explain in a bit more detail what you need to do.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Access stencil data
Not sure about shaders, I have never worked with them though.
To describe it more thoroughly.
Let's suppose I want to draw a shape. The shape takes up only specific pixels on the screen, while other stay untouched. I'd like to check all the pixels that WILL be affected by drawing this shape and check (math + access a table + the shape itself) if the pixel is a valid drawing area for this shape, if not, mask it out.
(What I am currently thinking is that I could check all pixels, which would not cause any functional issues, just performance drop.)
Then I will actually draw the shape, but it will be visible only on the valid pixels
Re: Access stencil data
You are probably right with the shaders, just need to learn how to do them now
I fact you are probably 100% right. The shaders should allow me to do calculations for each pixel of the shape using pixel effects.
I fact you are probably 100% right. The shaders should allow me to do calculations for each pixel of the shape using pixel effects.
Who is online
Users browsing this forum: Google [Bot] and 5 guests