For drawing a heatmap in OpenGL we want to give each point x,y, and value.
We could just store a vbo with these values and split it into two vertexattrib pointers:
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 3*sizeof(float), (void*)0);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 3*sizeof(float), (void*)sizeof(float));
However, when updating the values this would require writing only to the value between the xy points that are not changing. Is there a way to specify a separate array for the values so that each vertexattrib pointer comes from a different source?
@genpfault is suggesting a solution like this:
glBind(vboPoints);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
glBind(vboVals);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, (void*)0);
If this is correct, is there a limit to the number of different vbos that can be used in this way?
Is this slower than using a single block of memory with all values interleaved?