Page 3 of 7

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 1:39 pm
by coffee
Technicolour wrote:It looks like the pixels are drawing slightly transparently or something... My pixel drawing code is in gmb_gpu.lua at lines 536 and 536, it should be a pretty standard affair.

Code: Select all

love.graphics.setColor( Colour, Colour, Colour, 255 )
love.graphics.point( n + 0.5, YCo + 0.5 )
The positions are clearly correct, it's just the colour/transparency seems wierd.
I don't have knowledge enough on this tech questions. Could be perhaps a Canvas/OSX LuaJIT only problem or even something related with my mac GPU. Maybe slime or jasoco (they have also mac's) can test this and check if this was an isolated problem or not.

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 4:23 pm
by Xgoff
yeah i get the ghosting as well (in both your build and slime's)

if the only luajit thing you're using is the bit library, maybe someone could try the standalone version with an official love build, to see if it's a luajit bug

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 5:06 pm
by slime
Try setting the blend mode to "premultiplied" when drawing the canvas to the screen (before line 44 of main.lua).

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 5:09 pm
by Technicolour
slime wrote:Try setting the blend mode to "premultiplied" when drawing the canvas to the screen (before line 44 of main.lua).
Thanks, I can't unfortunately test it (as I don't have the issue), so if someone who is having the issue would mind testing it that'd be great! May I ask what exactly "premultiplied" blendmode does? The wiki doesn't reveal anything.

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 5:27 pm
by coffee
I changed to this and things got better. but not perfect yet.

Code: Select all

    love.graphics.setBlendMode( "premultiplied" )
    love.graphics.draw(canvas, 10, 10, 0, 3, 3)
    love.graphics.setBlendMode( "alpha" )
EDITED:
Conclusions: Got the output more whited and less blacked and some effects like in opening logo got better. Still having ghosting in mostly scenes.

EDITED2: Screenshots uploaded
5.png
6.png

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 5:45 pm
by Xgoff
i wouldn't think you'd need premultiplied alpha anyway since as far as i know, the gameboy only uses simple masking for transparency

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 5:58 pm
by Technicolour
Xgoff wrote:i wouldn't think you'd need premultiplied alpha anyway since as far as i know, the gameboy only uses simple masking for transparency
It's not the alpha for the gameboy itself (that's handled entirely in software), rather, there's an issue with the alpha when the pixels are being drawn to the canvas and/or the canvas being drawn to the window.

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 6:17 pm
by Xgoff
i can get it to work "correctly" if i clear the canvas with 255, 255, 255, 255 right after setting it

"correctly" as in it doesn't work well with the "drawing only changed pixels" optimization. but then if you removed that optimization you wouldn't need canvas clearing anyway. unfortunately clearing is really fast :(

using imagedata instead of canvas might be an option (as you only need points) but unfortunately there's no way to set imagedata data from a table (without expensive per-pixel functions)

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 6:20 pm
by Technicolour
Yeah unfortunately without the only-updating-changed-pixels optomisation the fps is in signle figures at best.

Re: I Love Gameboy

Posted: Mon Apr 16, 2012 7:42 pm
by SiENcE
Hey,

i added a lua bitwise operation lib and a fix to run it on 0.7.2.

But, i only get a nearly corrrect screen on 0.8.0.

On 0.7.2 is something wrong.

This might be, because in 0.7.2 the framebuffer is cleared after you have drawn it. In 0.8.0 you have to clear the canvas yourself.