In es 1.0, I was able to use indexing into an existing vertex buffer in the glDrawElements method. This allowed me to specify only 4 points for drawing a square or rectangle. without the indexing I would have needed 6 points making up 2 triangles. How could I do this in ES 2.0?

glVertexAttribPointer index

Search for: glVertexAttribPointer index

a good attempt at stackoverflow

Reusing vertices glVertexAttrib pointer

Search for: Reusing vertices glVertexAttrib pointer


#version 400
layout(location=0) in vec4 in_Position;
layout(location=1) in vec4 in_Color;
out vec4 ex_Color;
void main(void)
{
    gl_Position = in_Position;
    ex_Color = in_Color;
}

for instance the variable in_Position refers to the index of 0.

Real nice. This may be the solution: IBO

This is a superb effort:http://openglbook.com/

GL_ELEMENT_ARRAY_BUFFER for indices?

Search for: GL_ELEMENT_ARRAY_BUFFER for indices?

use glDrawElements and not glDrawArrays. There you go!

glDrawElements

Search for: glDrawElements


void glDrawElements(   GLenum mode,
    GLsizei count,
    GLenum type,
    const GLvoid * indices);

Notice the indices argument.

This function exists in the Android Binding as well