var (
rotation float32
)
func init() {
runtime.LockOSThread()
}
func main() {
if err := glfw.Init(); err != nil {
log.Fatal(err)
}
window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil)
if err != nil {
log.Fatal(err)
}
window.MakeContextCurrent()
if err := gl.Init(); err != nil {
log.Fatal(err)
}
for !window.ShouldClose() {
var ratio float64
ratio = 640 / 480
gl.Viewport(0, 0, 640, 480)
gl.Clear(gl.COLOR_BUFFER_BIT)
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(-ratio, ratio, -1, 1, 1, -1)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Begin(gl.TRIANGLES)
gl.Color3f(1, 0, 0)
gl.Vertex3f(-0.6, -0.4, 0)
gl.Color3f(0, 1, 0)
gl.Vertex3f(0.6, -0.4, 0)
gl.Color3f(0, 0, 1)
gl.Vertex3f(0, 0.6, 0)
gl.End()
window.SwapBuffers()
glfw.PollEvents()
}
glfw.Terminate()
}