Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Multiple buffer in one vbo

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2018
    Posts
    3

    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.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,478
    Quote Originally Posted by pommeC View Post
    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.
    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...

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


    The latter is what I think you're calling "multiple buffers".
    Last edited by Dark Photon; 02-19-2018 at 06:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •