C++ OPENGL help wanted to port glbegin and end


I have this code in openGL, which works, but I would like to eliminate the glbegin and glend to meet OpenGL ES standards.
Can anyone out there help?

#include "painter.hpp"
#include "GL/glut.h"

void Painter::bar(int x1, int y1, int x2, int y2)
  glColor3f(0, 1, 0);
  glVertex2f(x1, y1);
  glVertex2f(x2, y1);
  glVertex2f(x2, y2);
  glVertex2f(x1, y2);

void Painter::circle(int x, int y, int radius)
  glColor3f(1, 0, 0);
  glVertex2f(x + radius, y);
  glVertex2f(x, y + radius);
  glVertex2f(x - radius, y); 
  glVertex2f(x, y - radius);

You need to read about vertex buffer objects. I would search for “OpenGL ES tutorials” you will find things like http://www.raywenderlich.com/3664/opengl-es-2-0-for-iphone-tutorial

For GL ES you don’t actually need buffer objects; you can use vertex arrays from client memory too. In this case, since it looks as though the vertex data is going to be fully dynamic, I’d suggest client memory rather than buffer objects as otherwise you get into the complexity of how to dynamically update them without synchronization/contention.

Thanks very much for everyone’s advice. I’ll look into a few gl es tutorials.