veandco / go-sdl2

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

doesn't draw content initially on macOS Mojave #364

Open Noofbiz opened 5 years ago

Noofbiz commented 5 years ago

Currently, when you open a window with a GLContext in macOS Mojave, drawing doesn't start until you manually move the window. To fix it, the NSGLContext has to be updated a couple times before calling Window.GLSwap(). I have a fix for it here that makes the NSGLContext calls that can be used before GLSwap(). I'm wondering if you guys would like that incorporated into go-sdl2 in the glswap call?

veeableful commented 5 years ago

Hi @Noofbiz, it sounds like maybe SDL2 itself need to fix this. Perhaps you could report it to them at https://discourse.libsdl.org? Although without a native C version of a program that reproduces this issue, I can't be 100% sure it's their issue.

Noofbiz commented 5 years ago

Yeah, the issue is in SDL itself. Looks like it's already been reported here.

bartgrantham commented 5 years ago

Are you polling any events? I discovered that even on non-GL windows the window doesn't raise or draw window decorations without pumping events. You don't even have to do anything with the events, but you have to at least consume the first two (sdl.WINDOWEVENT_SHOWN, followed by sdl.WINDOWEVENT_EXPOSED) before the window appears.