veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.21k stars 221 forks source link

raspberry pi fullscreen window #402

Closed fopina closed 5 years ago

fopina commented 5 years ago

I'm not sure this issue would fit into here but I've been looking for libsdl2 and raspberry pi driver and can't find anything.

So I simplified my use to something like this.

If I run this in Mac I get the 800x600 window scaled up so that 800 will fit my 1280 resolution (leaving black bars in the sides).

If I run it in my raspberrypi I get this pi

So, instead of scaling to fit the 1920 height, it sits there in the corner with what seems close to the original height.

Any hints on SDL initialization or parameters that might be missing? If I don't use FULLSCREEN and use a window with the size of my TV resolution it works, but a few issues:

veeableful commented 5 years ago

Hi @fopina, I never tried go-sdl2 on Raspberry Pi before but have you tried putting the rendering code inside the loop? I'm just wondering if it needs time to draw properly.

fopina commented 5 years ago

thank you for that reply so quick I couldn't even test it at the time!

do you rendering it like the change I made to the gist?

Because it does indeed seem to use the full screen now even though a small rect stays in the corner

asd

I'll look into my original code on why it does not happen like this, because it did render inside the loop...

Thanks 👍 I think I can close this, but is there any justification for this? Does the FULLSCREEN flag render once or twice as window before switch to fullscreen (and then renders after that one pick it up)?

veeableful commented 5 years ago

No justification from me. That was just a pure guess! I should get myself a Raspberry Pi.. Do you mind to tell me which Raspberry Pi you have?

I just noticed you don't have sdl.Init(). Have you tried calling sdl.Init(sdl.INIT_VIDEO) at the top of the run function to see if that helps?

fopina commented 5 years ago

I based myself on the cgo routines render example in the repo, but I’ll check that then.

Thank you again for your educated guess :) I’ll try to understand why my actual code does not behave like this as it already renders inside the loop

fopina commented 5 years ago

sdl.Init did not solve for that sample code, but it doesn't matter as Clear + Present inside the loop does solve the issue though my actual code always had that in the loop and doesn't get a resized Rect for some reason...

I'll close this anyway to avoid polluting project issues and re-open if I actually find one :) thanks.