Created
September 20, 2021 01:51
-
-
Save decitrig/0b441fc47e018bcb6dff658d15ebe1b0 to your computer and use it in GitHub Desktop.
Segfaults with glfw as well
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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