more general render_command function
only change render state when necessary
code cleanup
experimented with sorting by texture/program
sort by collecting draw commands in buckets and issue them sorted