title: why is glVertexAttribDivisor crashing?
body: <p>I am trying to render some trees with instancing. This is rather weird, but before sleeping yesterday night, I checked the code, and it was in a running state, when I got up this morning, it is crashing when I am calling <code>glVertexAttribDivisor</code> I haven't changed any code since yesterday.</p>
  
  <p>Here is how I am sending data to GPU for instancing.</p>
  
  <pre><code>glGenBuffers(1, &amp;iVBO);
  glBindBuffer(GL_ARRAY_BUFFER, iVBO);
  glBufferData(GL_ARRAY_BUFFER, (ml_instance-&gt;i_positions.size()*sizeof(glm::vec4)) , NULL, GL_STATIC_DRAW);
  glBufferSubData(GL_ARRAY_BUFFER, 0, (ml_instance-&gt;i_positions.size()*sizeof(glm::vec4)), &amp;ml_instance-&gt;i_positions[0]);
  </code></pre>
  
  <p>And then in vertex specification--</p>
  
  <pre><code>glBindBuffer(GL_ARRAY_BUFFER, iVBO);
  glVertexAttribPointer(i_positions, 4, GL_FLOAT, GL_FALSE, 0, 0);
  glEnableVertexAttribArray(i_positions);
  glVertexAttribDivisor(i_positions,1); // **THIS IS WHERE THE PROGRAM CRASHES**
  
  glDrawElementsInstanced(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0,TREES_INSTANCE_COUNT);
  </code></pre>
  
  <p>I have checked <code>ml_instance-&gt;i_positions</code>, it has all the data that needs to render.</p>
  
  <p>I have checked the value of <code>i_positions</code> in vertex shader, it is the same as whatever I have defined there.</p>
  
  <p>I am little out of ideas here, everything looks pretty much fine. What am I missing?</p>