In
the OpenGL template, there are
two
helper classes called
CVertexBufferObject and
CVertexBufferObjectIndexed that
simplify usage of VBOs. They both
provide generic containers to store data and upload to the GPU.
- CVertexBufferObject is
for non-indexed drawing (glDrawArrays)
- CVertexBufferObjectIndexed is
for indexed drawing (glDrawElements)
CVertexBufferObject vbo; //
Instantiates object
vbo.Create(); //
Creates a VBO
vbo.Bind(); //
Binds the VBO
vbo.AddData(…); //
Adds data to the VBO (position, colour, etc.)
vbo.UploadDataToGPU(hint);
// Sends data to the GPU using hint
Examples
of usage in CPlane and CSphere
classes