veandco / go-sdl2

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

sdl: handle adaptive vsync (-1) in GLGetSwapInterval #568

Closed Lundis closed 1 year ago

Lundis commented 1 year ago

My system uses adaptive vsync by default, which means SDL_GL_GetSwapInterval returns -1, which go-sdl's errorFromInt() treated as an error. It couldn't get an error from SDL so it gave me "Unknown error (probably using old version of SDL2 and the function called is not supported?)"

(Note that SDL_GL_SetSwapInterval is correctly mapped, and a -1 there means an actual error)

veeableful commented 1 year ago

Thank you @Lundis for the PR! I will merge this as well.