Closed EliiasG closed 1 year ago
This may not be enough to fix the problem, but that code is missing a call to lock the execution of goroutine that runs the main
function to the main OS thread. Trying to use GLFW or OpenGL without doing that will cause non-deterministic problems. See https://pkg.go.dev/runtime#LockOSThread docs:
All init functions are run on the startup thread. Calling LockOSThread from an init function will cause the main function to be invoked on that thread.
A goroutine should call LockOSThread before calling OS services or non-Go library functions that depend on per-thread state.
That is, the code above needs to also have:
func init() { runtime.LockOSThread() }
Oh thank you, i think it is fixed now.
I tried making something combining learnopengl and the 4.1 example and the following code works, however when i uncomment any the of the commented out function calls in the render loop my program will crash with a weird error. I also tried checking for errors when linking the shader, it is still broken
The error