Created
December 11, 2019 09:44
-
-
Save ilyar/d0deebca09765adfd9ef41b6b63cdf19 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
| "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