Draw the selection values to the buffer

Property definitions

gamnit :: selection $ App :: draw_selection_screen
	# Draw the selection values to the buffer
	private fun draw_selection_screen
	do
		selection_calculated = true

		app.selection_program.use
		app.selection_program.mvp.uniform app.world_camera.mvp_matrix

		# Set aside previous buffer clear color
		var user_r = glGetFloatv(gl_COLOR_CLEAR_VALUE, 0)
		var user_g = glGetFloatv(gl_COLOR_CLEAR_VALUE, 1)
		var user_b = glGetFloatv(gl_COLOR_CLEAR_VALUE, 2)
		var user_a = glGetFloatv(gl_COLOR_CLEAR_VALUE, 3)

		glClearColor(0.0, 0.0, 0.0, 1.0)
		glClear(gl_DEPTH_BUFFER_BIT | gl_COLOR_BUFFER_BIT)

		# TODO restrict the list of actors with a valid ID, maybe with an `active_actors` list?

		var id = 1
		for actor in actors do
			selection_map[id] = actor
			for leaf in actor.model.leaves do
				leaf.material.draw_selection(actor, leaf, id)
			end

			id += 1
			#id += 100 # Debug
		end

		# Debug, show the selection values for half a second
		#display.flip
		#0.5.sleep

		glClearColor(user_r, user_g, user_b, user_a)
	end
lib/gamnit/depth/selection.nit:99,2--134,4