func draw() { gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) gl.PushMatrix() gl.Rotated(view_rotx, 1.0, 0.0, 0.0) gl.Rotated(view_roty, 0.0, 1.0, 0.0) gl.Rotated(view_rotz, 0.0, 0.0, 1.0) gl.PushMatrix() gl.Translated(-3.0, -2.0, 0.0) gl.Rotated(angle, 0.0, 0.0, 1.0) gl.CallList(gear1) gl.PopMatrix() gl.PushMatrix() gl.Translated(3.1, -2.0, 0.0) gl.Rotated(-2.0*angle-9.0, 0.0, 0.0, 1.0) gl.CallList(gear2) gl.PopMatrix() gl.PushMatrix() gl.Translated(-3.1, 4.2, 0.0) gl.Rotated(-2.0*angle-25.0, 0.0, 0.0, 1.0) gl.CallList(gear3) gl.PopMatrix() gl.PopMatrix() sdl.GL_SwapBuffers() Frames++ { t := sdl.GetTicks() if t-T0 >= 5000 { seconds := (t - T0) / 1000.0 fps := Frames / seconds print(Frames, " frames in ", seconds, " seconds = ", fps, " FPS\n") T0 = t Frames = 0 } } }
func draw() { gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) gl.PushMatrix() gl.Rotated(view_rotx, 1.0, 0.0, 0.0) gl.Rotated(view_roty, 0.0, 1.0, 0.0) gl.Rotated(view_rotz, 0.0, 0.0, 1.0) gl.PushMatrix() gl.Translated(-3.0, -2.0, 0.0) gl.Rotated(angle, 0.0, 0.0, 1.0) gl.CallList(gear1) gl.PopMatrix() gl.PushMatrix() gl.Translated(3.1, -2.0, 0.0) gl.Rotated(-2.0*angle-9.0, 0.0, 0.0, 1.0) gl.CallList(gear2) gl.PopMatrix() gl.PushMatrix() gl.Translated(-3.1, 4.2, 0.0) gl.Rotated(-2.0*angle-25.0, 0.0, 0.0, 1.0) gl.CallList(gear3) gl.PopMatrix() gl.PopMatrix() glfw.SwapBuffers() Frames++ { t := glfw.Time() if t-T0 >= 5 { seconds := (t - T0) fps := float64(Frames) / seconds print(Frames, " frames in ", int(seconds), " seconds = ", int(fps), " FPS\n") T0 = t Frames = 0 } } }