These programming practices optimize your application's performance:
To draw even a single triangle, use GL_TRIANGLES rather than GL_POLYGON.
Use a single call to glBegin(GL_QUADS) rather than calling glBegin(GL_POLYGON) repeatedly.
Use a single call to glBegin(GL_LINES) to draw multiple independent line segments, rather than calling glBegin(GL_LINES) multiple times.