// vim: shiftwidth=4 tabstop=4 noexpandtab package main import ( "runtime" "log" "flag" ) func init() { // lock this program to one OS thread (details: https://golang.org/pkg/runtime/#LockOSThread) log.Println("Locking OS thread") runtime.LockOSThread() } func main() { // read command line arguments var stlFilePath string parseFlags(&stlFilePath) // parse STL file stl, err := ReadBinaryStlFile(stlFilePath) if err != nil { log.Fatal(err) } vertices = stl.toVertices() // initialize application (includes GLFW/window) var app App = newApp(&stl) defer app.terminate() // GLFW needs to be terminated! // initialize graphics var graphics Graphics = newGraphics() app.graphics = &graphics // connect graphics to the app // main loop for !app.window.ShouldClose() { graphics.draw() app.handle() } } func parseFlags(stlFilePath *string) { flag.StringVar(stlFilePath, "file", "myfile.stl", "path to the binary STL file") flag.Parse() }