Skip to content

Instantly share code, notes, and snippets.

@ilyar
Created December 11, 2019 09:44
Show Gist options
  • Select an option

  • Save ilyar/d0deebca09765adfd9ef41b6b63cdf19 to your computer and use it in GitHub Desktop.

Select an option

Save ilyar/d0deebca09765adfd9ef41b6b63cdf19 to your computer and use it in GitHub Desktop.
package main
import (
"runtime"
"github.com/go-gl/glfw/v3.3/glfw"
)
func init() {
// This is needed to arrange that main() runs on main thread.
// See documentation for functions that are only allowed to be called from the main thread.
runtime.LockOSThread()
}
func main() {
err := glfw.Init()
if err != nil {
panic(err)
}
defer glfw.Terminate()
window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil)
if err != nil {
panic(err)
}
window.MakeContextCurrent()
for !window.ShouldClose() {
// Do OpenGL stuff.
window.SwapBuffers()
glfw.PollEvents()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment