title: Binding a second vertex buffer seems to spoil my first vertex buffer, OpenGL OES ios 5.1
body: <p>I'm creating two different vertex buffers, <em>that use two different shaders to render them</em>.  As soon as I bind the second vertex buffer, the data I parked in the first vertex buffer seems to be corrupted or lost.</p>
  
  <p>If I generate and draw one vertex buffer only, like so:</p>
  
  <pre><code>glGenBuffers( 1, &amp;vb1 ) ;
  glBindBuffer( GL_ARRAY_BUFFER, vb1 ) ;
  
  // fill it..
  glBufferData( .. )
  </code></pre>
  
  <p>Then, in the draw() loop,</p>
  
  <pre><code>glUseProgram( shader1 ) ;
  glBindBuffer( vb1 ) ; // make sure it is bound
  glDrawArrays( ... )   // draw it
  </code></pre>
  
  <p>Then it works fine, no problems, no errors (I am glGettingLastError() after <em>every</em> gl* call, so it seems this code is perfectly fine)</p>
  
  <p>Now if I so much as <em>generate and bind</em> a second vertex buffer, any time after the first one was generated and bound,</p>
  
  <pre><code>// ran in init() -- then previously working code in draw() is broken
  glGenBuffers( 1, &amp;vb2 ) ;              // ok.. no problems with this line
  glBindBuffer( GL_ARRAY_BUFFER, vb2 ) ; // spoils data in vb1?
  </code></pre>
  
  <p>As soon as I call <code>glBindBuffer</code> with this newly generated <code>vb2</code> buffer, it seems the data in <code>vb1</code> is completely dumped or lost. On attempts to draw <code>vb1</code> (not <code>vb2</code>!), i get this crash:</p>
  
  <p><img src="https://i.stack.imgur.com/wn0M7.png" alt="enter image description here"></p>
  
  <p>I even filled the array with <code>GL_STATIC_DRAW</code>.</p>
  
  <p>I don't understand, I thought these vertex buffers were supposed to retain data, even if another vertex buffer is created and initialized?  .. what am I doing wrong?</p>