I am in the process of converting an openGL ver 1.0 application to a more modern version. I am stuck on a function and need some help.
basically we read in data points from a file [.SLC] format
the data is then inside a data structure of
vector<vector<vector<float, float, float>>>
the old rendering:
for [size of first vector]
for [size of second vector]
glBegin(GL_LINE_LOOP);
for [size of third vector]
glVertex3f(float, float, float);
glEnd();
this 3 layer loop represents a single object that I am trying to render via a single call to some method similar to this. I can't seem to get this right though.
glVertexAttribPointer(vp, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), nullptr);
glDrawElements(GL_LINE_LOOP, indices.size() / sizeof(uint32_t), GL_UNSIGNED_INT, NULL);
can someone please point me in the right direction. If you need more information please let me know and Ill try to explain further. Thanks
My issue is putting together the collection of vertex / index to send to the render function.
As the example shows there are 3 loops. I was thinking that just before the start of the 3rd loop start collecting the vertex data.
That part is easy, but the index collection confuses me. If the 3rd loop has [N] vertex should I also have [N] index.
At this point should I send those 2 collections to the render function? If yes then that could end up with hundreds of calls to the render function so the next question would be is there a way to combine all of the data and send it as a single call?