// 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 _, err := ReadBinaryStlFile(stlFilePath) if err != nil { log.Fatal(err) } // initialize application (includes GLFW/window) var app App = newApp() defer app.terminate() // GLFW needs to be terminated! // init OpenGL program := initOpenGL() vao := makeVao(triangle) // main loop for !app.window.ShouldClose() { app.handle() draw(vao, program) } } func parseFlags(stlFilePath *string) { flag.StringVar(stlFilePath, "file", "myfile.stl", "path to the binary STL file") flag.Parse() }