OpenGL index buffer object with additional data
Posted
by muksie
on Stack Overflow
See other posts from Stack Overflow
or by muksie
Published on 2010-04-08T09:28:00Z
Indexed on
2010/04/08
9:53 UTC
Read the original article
Hit count: 206
opengl
I have a large set of lines, which I render from a vertex buffer object using glMultiDrawArrays(GL_LINE_STRIP, ...);
This works perfectly well. Now I have lots of vertex pairs which I also have to visualize. Every pair consists of two vertices on two different lines, and the distance between the vertices is small. However, I like to have the ability to draw a line between all vertex pairs with a distance less than a certain value.
What I like to have is something like a buffer object with the following structure:
i1, j1, r1,
i2, j2, r2,
i3, j3, r3,
...
where the i's and j's are indices pointing to vertices and the r's are the distances between those vertices. Thus every vertex pair is stored as a (i, j, r) tuple. Then I like to have a (vertex) shader which only draws the vertex pairs with r < SOME_VALUE as a line.
So my question is, what is the best way to achieve this?
© Stack Overflow or respective owner