separate creating and drawing of objects

Hi. I would like to create a class for each model to make things more clear, which looks like this:

struct vertex {
__glm::vec3 position;
__glm::vec3 normal;

class triangle {
__triangle() {
____// initialise vertices and indices


____vao = vbo = vio = -1;

____// bind data to buffers
__void draw() {
____// bind vbo and call glDrawElements()
__void populate() {
____// generate buffers and bind to them …
__void compute_normals() {}
__std::vector<vertex> vertices;
__std::vector<unsigned int> indices;

__GLint vbo, vio, vao;

Can I create multiple objects (triangles, cubes, etc.) and
bind their data to GL_ARRAY_BUFFER separately with their own OBOs? How?

When rendering multiple objects, how to pass their vertices to vertex shader?
Do I need to create the same number of vertex variables in the shader file?
And glVertexAttribPointer() needs an index of the attribute which cannot be
determined at compile time. Does that mean I still needs some globals (shader program)
in draw()?

Typo, should be VBOs.

Solved. You can bind any number of VBOs to GL_BUFFER_ARRAY. The strategy above works well:)