0

I have two programs which I am switching between. I loaded my position data up in a VBO and then set up my vertex attribute arrays for my first program. When I switch to the second program and attempt to set up my vertex attribute arrays using the same data, it fails to draw. If I make a second buffer using the exact same code however, and I use it for the second program, they both draw fine. I was wondering if someone might clarify the rules of sharing these VBO's between programs as I'd rather not have two buffers unless they are needed.

David
  • 1,648
  • 1
  • 16
  • 31
  • Absolutely. Vertex setup is completely orthogonal to what program is bound. As long as the attribute locations match between the programs, you could even use the same VAO. – Reto Koradi Sep 16 '14 at 03:53
  • @RetoKoradi - I am very much at a loss as to why I would be able to use one buffer instead of the other when this is the only difference? I will continue testing and post here if I find otherwise – David Sep 16 '14 at 15:28
  • @RetoKoradi - I found a complex bug in my application that was leading to this condition. You are correct in your statement that this is possible to have multiple programs using the same VBO. – David Sep 16 '14 at 15:36
  • Can you post an answer explaining what caused it? – Reto Koradi Sep 17 '14 at 07:22

1 Answers1

0

Yes, multiple programs can be bound to the same VBO with no problem. My issue ended up being with another part of my program loading a separate VBO which was missing some of the vertices and had nothing to do with the use of two programs.

David
  • 1,648
  • 1
  • 16
  • 31