func InitGL(smooth bool, multisample int) { core.Fatal(gl.Init()) gl.Enable(gl.LIGHTING) gl.Enable(gl.CULL_FACE) gl.CullFace(gl.BACK) if multisample != 0 { gl.Enable(gl.MULTISAMPLE) } if smooth { gl.ShadeModel(gl.SMOOTH) } }
// draw draws the triangle. func draw() { gl.ClearColor(0.3, 0.3, 0.3, 0.0) gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) gl.ShadeModel(gl.SMOOTH) gl.LoadIdentity() gl.Translatef(-15.0, -15.0, 0.0) gl.Begin(gl.TRIANGLES) gl.Color3f(1.0, 0.0, 0.0) gl.Vertex2f(0.0, 0.0) gl.Color3f(0.0, 1.0, 0.0) gl.Vertex2f(30.0, 0.0) gl.Color3f(0.0, 0.0, 1.0) gl.Vertex2f(0.0, 30.0) gl.End() win.SwapBuffers() }