glEnableClientState(GL_VERTEX_ARRAY);
GLuint VertexVBOID[2];
glGenBuffers(1, VertexVBOID);
glBindBuffer(GL_ARRAY_BUFFER, VertexVBOID[0]);
glBufferData(GL_ARRAY_BUFFER, ((VertexTotal*3) * sizeof(float)), electrodexyz, GL_STATIC_DRAW);
GLuint IndexVBOID;
glGenBuffers(1, &IndexVBOID);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexVBOID);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (VertexTotal) * sizeof(unsigned int), indices, GL_STATIC_DRAW);
glVertexPointer(3, GL_FLOAT, 0, 0);
glDrawElements(GL_TRIANGLES, (VertexTotal), GL_UNSIGNED_INT, 0);
I’m currently using this to render a model of 50,000 vertices. The problem is that when rendering I get this output, rather than a brain model. I believe the indices must be wrong, but I can’t determine how. When importing the model I add each x,y,z coord to an array of 3 times the number of vertices (for x,y,z).
Then for each vertex I add count++ to the value of the indices, example array[0] = 1; array[1] = 2; array[n] = n+1;
Am I approaching using VBO’s and IBO’s wrong?
Help is greatly appreciated