diff options
author | xengineering <mail2xengineering@protonmail.com> | 2021-05-20 12:16:36 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2021-05-20 12:20:19 +0200 |
commit | fbd513c7c2531c12fcd7e81bd4ce66c5ec5f6902 (patch) | |
tree | b564bbd69ab81e823c2153d57d0bbc40508458d7 /main.go | |
parent | 904fa404b6e38564d1486b3b698ef1cb3d63ba8b (diff) | |
download | stlscope-fbd513c7c2531c12fcd7e81bd4ce66c5ec5f6902.tar stlscope-fbd513c7c2531c12fcd7e81bd4ce66c5ec5f6902.tar.zst stlscope-fbd513c7c2531c12fcd7e81bd4ce66c5ec5f6902.zip |
Implement STL Parsing
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -0,0 +1,50 @@ +// vim: shiftwidth=4 tabstop=4 noexpandtab + +package main + +import ( + "runtime" + "log" + "flag" + + "github.com/go-gl/glfw/v3.3/glfw" +) + +var ( + stlFilePath string +) + +func main() { + + // read command line arguments + parseFlags() + + // parse STL file + _, err := ReadBinaryStlFile(stlFilePath) + if err != nil { + log.Fatal(err) + } + + // lock this program to one OS thread (details: https://golang.org/pkg/runtime/#LockOSThread) + log.Println("Locking OS thread") + runtime.LockOSThread() + + // init GLFW and assert termination at end of main + window := initGlfw() + defer glfw.Terminate() + + // init OpenGL + program := initOpenGL() + + vao := makeVao(triangle) + + // main loop + for !window.ShouldClose() { + draw(vao, window, program) + } +} + +func parseFlags() { + flag.StringVar(&stlFilePath, "file", "myfile.stl", "path to the binary STL file") + flag.Parse() +} |