I have a method like this for a first-try to draw triangles in OpenGL 3.3 (Vec3 is from glm library):
void RenderOpenGL::DrawTriangle(const Vec3& pointA, const Vec3& pointB, const Vec3& pointC)
{
glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec3), glm::value_ptr(pointA), GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec3), glm::value_ptr(pointB), GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec3), glm::value_ptr(pointC), GL_STATIC_DRAW);
PrimitiveInfo primInfo;
primInfo.Mode = GL_TRIANGLES;
primInfo.Count = 3;
mPrimitiveInfo.push_back(primInfo);
}
I would then go through my Vector<PrimitiveInfo> mPrimitiveInfo and draw as the elements indicated.
From what I read on http://www.opengl.or...lBufferData.xml each consequent call to glBufferData will overwrite the old.
So how would you actually buffer this? Say I'm calling this method to draw three triangles, how would I actually buffer it without loosing the old data?
EDIT: and as a follow-up, how should you actually manage the VBOs? Right now I have a single buffer object to which I write data to but as you progress how would you distribute them?