So I made a system that proceduraly generates a VAO. I have a method finalizeModel() which does everything to the model that needs to be done. So I enable vertex attib array. I was thinking… say someone wants to load the VAO back up and add another attrib, would it be a fault if someone where to run finalizeModel() again? As per calling GL20.glEnableVertexAttribArray(i); twice.
public static Model finalizeModel() {
for (int i=0; i<current_vbos.length; i++)
GL20.glEnableVertexAttribArray(i);
GL30.glBindVertexArray(0);
return null;
}
public static Model load2DModel(float[] positions, float[] texture_coords, int[] indices) {
startNewModel(2, 1);
pushAttributeBuffer(0, 2, positions);
pushAttributeBuffer(1, 2, texture_coords);
pushIndexBuffer(indices);
finalizeModel();
return storeModel(new Model(current_model, current_vbos, current_offshore_vbos, indices.length));
}