title: Error using glMultiDrawArraysIndirect and indirect buffer
body: <p>I have two objects (A and B) to be rendered using glMultiDrawArraysIndirect(). Each object has a setupBuffers() method for creating, binding a vao, then creating and binding the indirect buffer, instanced ID buffer, vertices buffer and texture coords buffer. (using JOGL)</p>
  
  <p>Here is the problem: if I call setupBuffers() of the object A before calling setupBuffers() in B, then only B will be drawn; if I call setupBuffers() of the object B before calling setupBuffers() in A, then only A will be drawn. (No exception is found.) The data stored should be all correct since I've tested both of them.</p>
  
  <p>Object A:</p>
  
  <pre><code>protected void setupBuffers()
  {
      gl.glGenVertexArrays(1, vaoBuff);
      gl.glBindVertexArray(vaoBuff.get(0));
  
      gl.glGenBuffers(4, vboBuff);
  
      //bind indirect buffer object
      gl.glBindBuffer(GL4.GL_DRAW_INDIRECT_BUFFER, vboBuff.get(0));
      gl.glBufferData(GL4.GL_DRAW_INDIRECT_BUFFER, instanceCount * 4 * Integer.SIZE / 8, null, GL4.GL_STATIC_DRAW);
      gl.glBufferSubData(...);
  
      //bind draw instance ID in the shader with a buffer object
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboBuff.get(1));
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, instanceCount * Integer.SIZE / 8, drawIndexBuff, GL4.GL_STATIC_DRAW);
      gl.glVertexAttribIPointer(d_idLoc, 1, GL4.GL_UNSIGNED_INT, 0, 0);
      gl.glVertexAttribDivisor(d_idLoc, 1);
      gl.glEnableVertexAttribArray(d_idLoc);
  
      //bind vertex data buffer object
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboBuff.get(2));
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, instanceCount / column_subdivision * vertBuffSize * Float.SIZE / 8, null, GL4.GL_STATIC_DRAW);
      gl.glBufferSubData(...);
      gl.glVertexAttribPointer(verPosLoc, 3, GL4.GL_FLOAT, false, 0, 0);
      gl.glEnableVertexAttribArray(verPosLoc);
  
      //bind texture coordinate data buffer object
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboBuff.get(3));
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, instanceCount / column_subdivision * texBuffSize * Float.SIZE / 8, null, GL4.GL_STATIC_DRAW);
      gl.glBufferSubData(...);
      gl.glVertexAttribPointer(tc_inLoc, 2, GL4.GL_FLOAT, false, 0, 0);
      gl.glEnableVertexAttribArray(tc_inLoc);
  }
  </code></pre>
  
  <p>drawing method:</p>
  
  <pre><code>gl.glBindVertexArray(vaoBuff.get(0));
  gl.glMultiDrawArraysIndirect(GL4.GL_TRIANGLE_STRIP, 0, instanceCount, 0);
  </code></pre>
  
  <p>Object B:</p>
  
  <p>(the method 'setupBuffers()' is very similar to the one in A)</p>
  
  <p>drawing method:</p>
  
  <pre><code>gl.glBindVertexArray(vaoBuff.get(0));
  gl.glMultiDrawArraysIndirect(GL4.GL_PATCHES, 0, instanceCount, 0);
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Added:
  Now I have found the line causing that problem: </p>
  
  <pre><code>gl.glBindBuffer(GL4.GL_DRAW_INDIRECT_BUFFER, vboBuff.get(0));
  </code></pre>
  
  <p>This method used to bind a indirect buffer is called once both in Object A &amp; B, resulting in that problem, yet I have no idea why. Why is that? Is that the same using OpenGL (I'm using JOGL)? Or is that a bug of JOGL?</p>