go-gl / gl

Go bindings for OpenGL (generated via glow)
MIT License
1.07k stars 74 forks source link

Changing Viewport Causes Unexpected Signal Error on MacOS #89

Closed cjburkey01 closed 6 years ago

cjburkey01 commented 6 years ago

Hello! Currently, I have this little callback set so that when the screen resizes, the viewport sizes to match it:

callback := func(w *glfw.Window, wi int, he int) {
    width = wi
    height = he
    gl.Viewport(0, 0, 1920, 1080)
}
win.SetSizeCallback(callback);

The error, which is a little long, here's a PASTE.EE to it, occurs only if the gl.Viewport(0, 0, 1920, 1080) is present (ignore the constants, I was debugging).

Go version: go1.9.1 darwin/amd64 Mac version: 10.13(High sierra, no minor updates).

I am making sure that the window runs on the main thread with:

func init() {
    runtime.LockOSThread()
}

and I'm initializing OpenGL with:

win.MakeContextCurrent()
if err := gl.Init(); err != nil {
    panic(fmt.Errorf("opengl init error: %v\n", err))
}

Could this be a native error, or am I doing something wrong?

cjburkey01 commented 6 years ago

Ok, something weird just happened: I tried again, and it worked. I closed the window, launched it again, and it crashed. I tried again a few more times to see if it was temperamental, but it kept crashing. I don't know what this is, very weird.

dmitshur commented 6 years ago

Does the same behavior happen with the cube example for you? If not, what happens if you modify it slightly to have the same window size callback?

I don't immediately see you doing anything wrong in the information you posted, so I'd suggest starting with the example and seeing if the problem can be reproduced there. Perhaps that'll help narrow this down.

cjburkey01 commented 6 years ago

Sorry, I won’t be able to test until Monday. I’ll see how it reacts with that

errcw commented 6 years ago

(Closing due to inactivity. Please feel free to reopen!)