Instead of using vertex arrays, I’m using vertex buffers to specify the data for glDrawArrays.
I am using 3 buffers of the same size. I am updating the buffers from a framebuffer object by glReadPixels. The framebuffer object has 3 textures attached of size width*height in RGBA format and type GL_FLOAT.
According to the following code, the index_buffer should dictate in what sequence the points from the vertex_buffer are drawn. But instead the problem is that the points are drawn in a sequential manner from the vertex buffer.
glEnableClientState(GL_COLOR_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER, color_buffer);
glColorPointer(4, GL_FLOAT, 0, 0);
glEnableClientState(GL_INDEX_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER, index_buffer);
glIndexPointer(GL_FLOAT, 4, 0);
glBindBufferARB(GL_ARRAY_BUFFER, vertex_buffer);
glVertexPointer(4, GL_FLOAT, 0, 0);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(GL_POINTS, 0, width*height);