How do I replace glBegin() and related functions in OpenGL ES 2.0?
A basic example, to draw a triangle in OpenGL ES:
GLfloat glverts[9];
glVertexPointer(3, GL_FLOAT, 0, glverts);
glEnableClientState(GL_VERTEX_ARRAY);
//fill in vertex positions with your data
for (int i = 0; i < 3; i++) {
glverts[i*3] = ...;
glverts[i*3+1] = ...;
glverts[i*3+2] = ...;
}
glDrawArrays(GL_TRIANGLE_FAN, 0, 3);
EDIT: sorry, this is for OpenGL ES 1.1, not 2.0
You use Vertex Buffer Objects. Tutorial at NeHe: http://nehe.gamedev.net/tutorial/vertex_buffer_objects/22002/
The tutorial (the bulk text) is written for Windows. OpenGL-ES 2 on Android differs by that you don't have to load extensions manually and are given a properly prepared OpenGL context by the egl...
functions.
Another readable tutorial is http://www.songho.ca/opengl/gl_vbo.html
GL_POLYGONS have been abandoned from OpenGL-3 and -ES since they're cumbersome to work with and almost never used. Also GL_POLYGON can be perfectly replaced by GL_TRIANGLE_FAN. Or you do the clean thing and tesselate polygonal geometry into triangles yourself.