At client side, submit vertex positions and render:
GLuint vao, vbo;
glGenVertexArrays(1,&vao);
glBindVertexArray(vao);
glGenBuffers(1,&vbo);
glBindBuffer(GL_ARRAY_BUFFER,vbo);
glBufferData(GL_ARRAY_BUFFER,sizeof(GLfloat)4vertex_count,pVertexPositionData);
glVertexAttribPointer(0,4,GL_FLOAT,GL_FALSE,0,(void*)0);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLE,triangle_count,0);
glBindVertexArray(0);
But in the shader program, declare more attributes:
attribute vec4 vertex; // index 0
attribute vec4 color; // index 1
void main()
{
// color variable should contain undefined value
// how about use vertex variable only?
gl_Position=vertex;
}
In my experiment, it works well. Has specification described this situation, or it depends on the driver?