AttributeError: module 'bgl' has no attribute 'glColor4f'
While 2.80 is still under active development, not all of the templates included with blender have been updated with the changes needed to work with 2.80.

With the last of the python API changes about to be finalised any day, these remaining templates should get updated soon.

This post might help get you started with the bgl changes.