Ejemplo n.º 1
0
func main() {
	state.verbose = 1
	// Start OGLES
	initOGL(&state)
	for {
		if error := gl.GetError(); error != 0 {
			panic(fmt.Sprintf("An error occured with code: 0x%x\n", error))
		}
		egl.SwapBuffers(state.display, state.surface)
	}
}
Ejemplo n.º 2
0
func draw() {
	gl.BindFramebuffer(gl.FRAMEBUFFER, 0)
	gl.Clear(gl.COLOR_BUFFER_BIT)
	gl.BindBuffer(gl.ARRAY_BUFFER, vertexArrayBuffer)
	gl.VertexAttribPointer(attrPos, 4, gl.FLOAT, false, 0, nil)
	gl.BindBuffer(gl.ARRAY_BUFFER, colorArrayBuffer)
	gl.VertexAttribPointer(attrCol, 3, gl.FLOAT, false, 0, nil)
	gl.DrawArrays(gl.TRIANGLES, 0, 3)
	gl.Flush()
	gl.Finish()
	egl.SwapBuffers(display, surface)
}