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 3 of 3

Thread: Vertex Buffer and Index Buffer

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Vertex Buffer and Index Buffer

    Dear All,
    What is difference between Vertex Buffer and Index Buffer.In which they are used.

    RAJESH.R

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,979

    Re: Vertex Buffer and Index Buffer

    Veretx buffer is used to store vertex arrays (used with DrawArrays, DrawElements functions), index buffer is used to store indices that index vertices when rendering via DrawElements function (refer to API description for explanation).

  3. #3
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: Vertex Buffer and Index Buffer

    Vertex buffer stores vertex coordinates.
    Index buffer stores indices.
    If you connect vertices stored in vertex buffer in order defined by index array you'll get proper primitives rendered.
    For example:
    Code :
    (-1,1) (1, 1)
       .-----.
       |    /|
       |   / |
       |  /  |
       | /   |
       |/    |
       .-----.
    (-1,-1) (1, -1)
     
    Vertex array:
    -1,1, 1,1, 1,-1, -1,-1
    Index array:
    0, 1, 3, 1, 2, 3
    If you render GL_TRIANGLES using this index array and vertex array you'll get these two triangles rendered.

Posting Permissions

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