func main() { err := glfw.Init() if err != nil { panic(err) } defer glfw.Terminate() window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil) if err != nil { panic(err) } window.MakeContextCurrent() if err := gl.Init(); err != nil { panic(err) } // int width, height // glfw.GetFramebufferSize(window, &width, &height) for !window.ShouldClose() { // Do OpenGL stuff. gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) gl.Color3f(1, 1, 0) gl.Rectf(-0.75, 0.75, 0.75, -0.75) gl.Color3f(1, 0, 1) gl.Rectf(-0.5, 0.5, 0.5, -0.5) window.SwapBuffers() glfw.PollEvents() } }
func draw(screen [64][32]uint8) { for i := 0; i < 64; i++ { for j := 0; j < 32; j++ { color := float32(screen[i][j]) gl.Color3f(color, color, color) gl.Rectf(float32(i), float32(j), float32(i+1), float32(j+1)) } } window.SwapBuffers() }