Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualhaegarr

Posted 03 January 2013 - 08:41 AM

I want 2 VBOs but how? If I bind one buffer and then the next will the first buffer not be unbound? Or is it enough to bind the buffer, set the vertex attrib pointers and then unbind it again before the draw call?
There is perhaps still a misunderstanding. The vertex positions are the same for the faces, edges, and point handles. You need only 1 VBO with the position, and that is the VBO I've mentioned as "shared". However, you need to transport the edge color as well, and that attribute is unique to edge rendering. Hence create another VBO for the edge color (but notice that it is still given for each vertex; but that isn't a problem with your kind of coloring the edges).

Then do as follows (schematic):
1. bind (shared) VBO with positions
2. set attribute pointer for positions
3. bind VBO with colors
4. set attribute pointer for colors
5. bind index buffer for edges
6. draw edges
7. clean up

If the shared VBO contains colors, too, because you deal with it in face rendering ... it doesn't matter, because you ignore it (i.e. you don't use it with the attribute pointer setting) during edge rendering.

#1haegarr

Posted 03 January 2013 - 08:40 AM

I want 2 VBOs but how? If I bind one buffer and then the next will the first buffer not be unbound? Or is it enough to bind the buffer, set the vertex attrib pointers and then unbind it again before the draw call?

There is still a misunderstanding. The vertex positions are the same for the faces, edges, and point handles. You need only 1 VBO with the position, and that is the VBO I've mentioned as "shared". However, you need to transport the edge color as well, and that attribute is unique to edge rendering. Hence create another VBO for the edge color (but notice that it is still given for each vertex; but that isn't a problem with your kind of coloring the edges).

 

Then do as follows (schematic):

1. bind (shared) VBO with positions

2. set attribute pointer for positions

3. bind VBO with colors

4. set attribute pointer for colors

5. bind index buffer for edges

6. draw edges

7. clean up

 

If the shared VBO contains colors, too, because you deal with it in face rendering ... it doesn't matter, because you ignore it (i.e. you don't use it with the attribute pointer setting) during edge rendering.


PARTNERS