From 40a2d5346ff30a7b4d16bbd935b1ce1b7c1ffb56 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Sat, 26 Apr 2014 09:56:28 +0200 Subject: [PATCH] now drawing --- ld48-29.go | 28 +++++++++++++++++++++++++--- log.mdown | 15 +++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/ld48-29.go b/ld48-29.go index 8964616..bce61fe 100644 --- a/ld48-29.go +++ b/ld48-29.go @@ -26,13 +26,16 @@ func main() { } defer glfw.Terminate() - window, err := glfw.CreateWindow(640, 480, "LD48", nil, nil) + window, err := glfw.CreateWindow(640, 480, "LD48-29", nil, nil) if err != nil { log.Panic(err) } window.MakeContextCurrent() + setup() + defer destroy() + for !window.ShouldClose() { render() window.SwapBuffers() @@ -40,6 +43,25 @@ func main() { } } -func render() { - // TODO: draw! +func setup() { + gl.Enable(gl.TEXTURE_2D) + gl.Enable(gl.DEPTH_TEST) + gl.Enable(gl.LIGHTING) + gl.Enable(gl.CULL_FACE) + + gl.ClearColor(0.0, 0.0, 0.5, 0) + gl.ClearDepth(1) + gl.DepthFunc(gl.LEQUAL) +} + + +func destroy() { + // TODO: release objects +} + +func render() { + gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) + gl.MatrixMode(gl.PROJECTION) + gl.LoadIdentity() + gl.Frustum(-1, 1, -1, 1, 1.0, 10.0) } diff --git a/log.mdown b/log.mdown index 8a7f151..3c76ab5 100644 --- a/log.mdown +++ b/log.mdown @@ -4,11 +4,13 @@ All time is CEST - 07:14 - Wake up, discover the theme on Twitter. Start scrambling ideas. Take breakfast. + Wake up, discover the theme on Twitter. Start scrambling ideas. Take + breakfast. - 08:22 - Initialise github repo. A few ideas popping up already. Try to avoid obvious sea references. + Initialise github repo. A few ideas popping up already. Try to avoid obvious + sea references. - 08:35 @@ -17,3 +19,12 @@ All time is CEST - 08:41 Dev log now publicly advertised. + +- 09:51 + + First hurdle. GL doesn't want to Clear and I have no clue. + +- 09:55 + + Duh. Found via rubberducking I Was calling some stuff *before* + MakeContextCurrent. 20min lost.