// renders the display on each update
func render() {
	gl.Clear(gl.COLOR_BUFFER_BIT)
	gl.Enable(gl.BLEND)
	gl.Enable(gl.POINT_SMOOTH)
	gl.Enable(gl.LINE_SMOOTH)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.LoadIdentity()

	// draw pipes
	for _, pipeBox := range pipe {
		gl.PushMatrix()
		pos := pipeBox.Body.Position()
		gl.Translatef(float32(pos.X), float32(pos.Y), 0.0)
		drawSquare(.19, .8, .19, 1) // limegreen
		gl.PopMatrix()
	}

	// draw flappy
	for _, flappyBird := range flappyBirds {
		gl.PushMatrix()
		pos := flappyBird.Body.Position()
		gl.Translatef(float32(pos.X), float32(pos.Y), 0.0)
		drawSquare(1, .84, 0, 1) // gold
		gl.PopMatrix()
	}

	gl.Color4f(1, 0, 1, 1)
	scoreStr := "[ Score: " + strconv.Itoa(score) + " ]"
	// draw score
	drawScore(scoreStr)
}
func drawSquare(colorRed, colorGreen, colorBlue, alpha float32) {
	// first draw the first dark layer
	gl.Color4f(0, 0, 0, 1)
	gl.Begin(gl.POLYGON)
	gl.Vertex2d(float64(pipeSide/2), float64(pipeSide/2))
	gl.Vertex2d(float64(-pipeSide/2), float64(pipeSide/2))
	gl.Vertex2d(float64(-pipeSide/2), float64(-pipeSide/2))
	gl.Vertex2d(float64(pipeSide/2), float64(-pipeSide/2))
	gl.End()

	// then draw the actual color layer
	gl.Color4f(colorRed, colorGreen, colorBlue, alpha)
	gl.Begin(gl.POLYGON)
	gl.Vertex2d(float64(innerPipeSide/2), float64(innerPipeSide/2))
	gl.Vertex2d(float64(-innerPipeSide/2), float64(innerPipeSide/2))
	gl.Vertex2d(float64(-innerPipeSide/2), float64(-innerPipeSide/2))
	gl.Vertex2d(float64(innerPipeSide/2), float64(-innerPipeSide/2))
	gl.End()

	gl.Vertex3f(0, 0, 0)
}