From aad26e524922d144fd4ed023dc0d60fadb62f253 Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 21 May 2021 15:11:50 +0200 Subject: First Rendering of an STL Model --- graphics.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'graphics.go') 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. -- cgit v1.2.3-70-g09d2