0
votes

So when I try and map this rgb value onto my data:

image=love.image.newImageData(WIDTH,HEIGHT,"rgba16f")

image:mapPixel(pixelFunction)

image2=love.graphics.newImage(image)


function pixelFunction(x, y, r, g, b, a)
    return 0,50,0,255
end

I get thisenter image description here

As you can see this is something like (0,255,0,255) not the rgb value I wanted, in fact it seems only able to render the max red green or blue value, making the function ponitless

1

1 Answers

0
votes

As one could guess from the fact that only extreme colors are generated, the value 50 is beyond the dynamic range. Using rgba representation in fractions of one (0, 50/255, 0, 1) does result in dark green.

(0,50,0,255) used to work in love 10. According to wiki it should work in love 11 with "rgba16f" that you seem to set. But it doesn't. Proceed to their bug reports section.

Also, please note that minimal reproducible example for the question should have been done along these lines:

WIDTH=300; HEIGHT=300;
imageData=love.image.newImageData(WIDTH,HEIGHT,'rgba16f')

function pixelFunction(x, y, r, g, b, a)
    return 0,50/255,0,255
end

imageData:mapPixel(pixelFunction)

image=love.graphics.newImage(imageData)

function love.draw()
    love.graphics.draw(image,0,0)
end

And yes, you've botched the order of definition and usage.