Skip to content

Instantly share code, notes, and snippets.

@decitrig
Created September 20, 2021 01:51
Show Gist options
  • Save decitrig/0b441fc47e018bcb6dff658d15ebe1b0 to your computer and use it in GitHub Desktop.
Save decitrig/0b441fc47e018bcb6dff658d15ebe1b0 to your computer and use it in GitHub Desktop.
Segfaults with glfw as well
package main
import (
"log"
"runtime"
"github.com/go-gl/gl/v3.3-core/gl"
"github.com/go-gl/glfw/v3.3/glfw"
)
func init() {
runtime.LockOSThread()
}
func main() {
if err := glfw.Init(); err != nil {
log.Fatal(err)
}
defer glfw.Terminate()
w, err := glfw.CreateWindow(800, 600, "Glfw window", nil, nil)
if err != nil {
log.Fatal(err)
}
w.MakeContextCurrent()
for !w.ShouldClose() {
gl.ClearColor(0, 0.1, 0, 1.0)
gl.Clear(gl.COLOR_BUFFER_BIT)
w.SwapBuffers()
glfw.PollEvents()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment