Multiple buffer in one vbo

Hello, I remember with webgl I was able to put multiple buffer inside a vbo and and point my buffers with vertexAttribPointer but for opengl I don’t know how to do. In the man page I can read :
Size “Specifies the number of components per generic vertex attribute. Must be 1, 2, 3, 4. Additionally, the symbolic constant GL_BGRA is accepted by glVertexAttribPointer. The initial value is 4.”

does it means I can only put 4 vertex data inside a vbo ?

thanks in advance.

That works just fine in OpenGL as well. I assume by “buffers” you mean blocks of vertex attribute data used in a single draw call (e.g. glDrawArrays(), glDrawElements(), etc.).

Just provide the appropriate byte offset into the bound ARRAY_BUFFER object in the “pointer” parameter: glVertexAttribPointer.

In the man page I can read :
Size "Specifies the number of components per generic vertex attribute. Must be 1, 2, 3, 4. …

That’s just the number of components in the data for a single vertex attribute binding (e.g. 4 for a vec4).

does it means I can only put 4 vertex data inside a vbo ?

No. It means, in a single vertex attribute binding (to be used by a draw call), the maximum number of components the value you provide for that attribute can have is 4. This is basically the vector dimension of the attribute. For instance, for float components, 1 = float, 2 = vec2, 3 = vec3, 4 = vec4. This (in combination with the component type) limits how much data can be provided for a single vertex on that single attribute for a single draw call.

However…

[ul]
[li]you have more than 1 attribute you can provide per draw call (16+ is common here),[/li][li]you can encode as many vertices as you want in each attribute list, and beyond that[/li][li]you can store the attribute data for multiple draw calls in a single VBO alongside each other.[/li][/ul]

The latter is what I think you’re calling “multiple buffers”.