So your initialisation should look a bit like this:
GLuint pVertexBufferObj; //You should remember this one, as it specifies the "location" of the data in GPU memory /* Generate a buffer object, and bind it with the data */ glGenBuffers(1, &pVertexBufferObj); glBindBuffer(GL_ARRAY_BUFFER, pVertexBufferObj); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex) * t->NumberVertices, t->vertices, GL_STATIC_DRAW); /* Tell OpenGL we're now done providing it our data */ glBindBuffer(GL_ARRAY_BUFFER, 0);
Next in the draw call you would specify the following:
glEnableClientState(GL_VERTEX_ARRAY); // glEnableClientState(GL_NORMAL_ARRAY); //If we're using normals // glEnableClientState(GL_TEXTURE_COORD_ARRAY); //If we're using textures glBindBuffer( GL_ARRAY_BUFFER, pVertexBufferObject); //3 = Number of elements (xyz), GL_FLOAT = Type of elements, sizeof(Vertex) = size of your elements in bytes, 0 = offset from the start of your vertex buffer object array glVertexPointer(3, GL_FLOAT, sizeof(Vertex), 0 ); //Same for Normal & Texture pointers glPushMatrix(); glDrawArrays(GL_TRIANGLES, 0, t->NumberVertices); glPopMatrix(); glBindBuffer( GL_ARRAY_BUFFER, 0 ); //glDisableClientState( GL_TEXTURE_COORD_ARRAY ); //glDisableClientState( GL_NORMAL_ARRAY ); glDisableClientState( GL_VERTEX_ARRAY );
Important thing to note here is that Vertex Buffer Objects do not have their coordinates stored in the CPU memory, but in the GPU memory. Sending the vertices off to a buffer object at every draw call defeats the purpose of using them, as they exist to reduce the bandwidth usage between CPU and GPU.

Find content
Male
