Skip to content

Instantly share code, notes, and snippets.

@reiver
Created December 29, 2013 01:55
Show Gist options
  • Save reiver/8166608 to your computer and use it in GitHub Desktop.
Save reiver/8166608 to your computer and use it in GitHub Desktop.
A very very basic #golang program that opens up a window using glfw ( https://github.com/jteeuwen/glfw ) that *could* (potentially) be used for OpenGL.
package main
import "fmt"
import "github.com/jteeuwen/glfw"
import "os"
import "time"
func main() {
// Open up a Window (that would potentially be used for OpenGL) with glfw
if err := glfw.Init(); err != nil {
fmt.Fprintf(os.Stderr, "[e] %v\n", err)
return
}
defer glfw.Terminate()
if err := glfw.OpenWindow(300, 300, 0, 0, 0, 0, 0, 0, glfw.Windowed); err != nil {
fmt.Fprintf(os.Stderr, "[e] %v\n", err)
return
}
// Wait a bit before exiting the program (and thus closing the window).
time.Sleep(5000 * time.Millisecond) // Wait for 5 seconds
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment