now drawing

This commit is contained in:
Loic Nageleisen 2014-04-26 09:56:28 +02:00
parent ef7206fada
commit 40a2d5346f
2 changed files with 38 additions and 5 deletions

View file

@ -26,13 +26,16 @@ func main() {
} }
defer glfw.Terminate() 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 { if err != nil {
log.Panic(err) log.Panic(err)
} }
window.MakeContextCurrent() window.MakeContextCurrent()
setup()
defer destroy()
for !window.ShouldClose() { for !window.ShouldClose() {
render() render()
window.SwapBuffers() window.SwapBuffers()
@ -40,6 +43,25 @@ func main() {
} }
} }
func render() { func setup() {
// TODO: draw! 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)
} }

View file

@ -4,11 +4,13 @@ All time is CEST
- 07:14 - 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 - 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 - 08:35
@ -17,3 +19,12 @@ All time is CEST
- 08:41 - 08:41
Dev log now publicly advertised. 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.