![Very Happy :D](./images/smilies/ms-glad.png)
Sadly, the performance of newScreenshot() is terrible on this computer, so i wanted to see how practical it would be for use on everyone else's computer, and if it was related to the fact that this computer has 64MB VRAM in it
![Razz :P](./images/smilies/ms-razz.png)
Code: Select all
function getcolours(image,x,y,p)
if x-1 > 0 and x+1 < 639 and y-1>0 and y+1 < 479 then
r1,g1,b1 = image:getPixel(x+p[1],y)
r2,g2,b2 = image:getPixel(x,y)
r3,g3,b3 = image:getPixel(x+p[1],y+p[2])
r4,g4,b4 = image:getPixel(x,y+p[2])
r = (r1+r2+r3+r4)/4
g = (g1+g2+g3+g4)/4
b = (b1+b2+b3+b4)/4
return r,g,b
else return image:getPixel(x,y) end
end
function shadermap(x, y, r, g, b, a)
--get the position relative to the pixel's chunk
if math.floor(x/2) == x/2 then
--rightmost
if math.ceil(y/2) == y/2 then
--bottom
r,g,b = getcolours(shot,x,y,{-1,-1})
else
--top
r,g,b = getcolours(shot,x,y,{-1,1})
end
else
--leftmost
if math.ceil(y/2) == y/2 then
--bottom
r,g,b = getcolours(shot,x,y,{1,-1})
else
--top
r,g,b = getcolours(shot,x,y,{1,1})
end
end
return r, g, b, a
end
function shader()
shot = love.graphics.newScreenshot( )
shot:mapPixel(shadermap)
shot = love.graphics.newImage(shot)
love.graphics.draw(shot,0,0)
end
so yeah, some results would be lovely, to see if it's worth developing a shader feature for ilopocalypse at all.