diff options
author | xengineering <mail2xengineering@protonmail.com> | 2021-05-21 15:11:50 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2021-05-21 15:11:50 +0200 |
commit | aad26e524922d144fd4ed023dc0d60fadb62f253 (patch) | |
tree | 862d5b1b813128f7912504f0261b11cc8eda9941 /graphics.go | |
parent | 78a83df3572c7a91dbcbca21d74d8d11170d947c (diff) | |
download | stlscope-aad26e524922d144fd4ed023dc0d60fadb62f253.tar stlscope-aad26e524922d144fd4ed023dc0d60fadb62f253.tar.zst stlscope-aad26e524922d144fd4ed023dc0d60fadb62f253.zip |
First Rendering of an STL Model
Diffstat (limited to 'graphics.go')
-rw-r--r-- | graphics.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/graphics.go b/graphics.go index 999b37d..87c21ed 100644 --- a/graphics.go +++ b/graphics.go @@ -13,8 +13,7 @@ import ( ) var ( - // a single triangle - triangle = []float32{ + vertices = []float32{ 0.0, 0.5, 0.0, -0.5, -0.5, 0.0, 0.5, -0.5, 0.0, @@ -24,7 +23,7 @@ var ( const ( // rotational speed and vector - OMEGA = 6 + OMEGA = 3 ROT_X = 0 ROT_Y = 1 ROT_Z = 1 @@ -92,7 +91,7 @@ func newGraphics() Graphics { gl.LinkProgram(graphics.program) // create VAO - graphics.vao = makeVao(triangle) + graphics.vao = makeVao(vertices) // create transformation matrix graphics.trafo = mgl32.HomogRotate3D(float32(glfw.GetTime()) * OMEGA, mgl32.Vec3{ROT_X, ROT_Y, ROT_Z}) @@ -110,7 +109,7 @@ func (graphics Graphics) draw() { gl.UniformMatrix4fv(graphics.trafoUniform, 1, false, &graphics.trafo[0]) gl.BindVertexArray(graphics.vao) - gl.DrawArrays(gl.TRIANGLES, 0, int32(len(triangle)/3)) + gl.DrawArrays(gl.TRIANGLES, 0, int32(len(vertices)/3)) } // makeVao initializes and returns a vertex array from the points provided. |