+ /* Unbind first if the legacy flag changes. The logic for supporting it
+ directly in apply_arrays would get too complicated, and this also allows
+ rebinding the same array with different legacy setting. */
+ if(legacy_used!=use_legacy)
+ unbind();
+
+ if(!use_legacy)
+ static Require _req(ARB_vertex_shader);
+ else if(legacy)
+ static Require _req(MSP_legacy_features);
+
+ const VertexArray *old = current();
+ /* If the array has been modified, apply it even if it was the last one to
+ be applied. This is necessary to get the data updated to vertex buffer, and
+ to resync things after a format change. Radeon drivers also have some
+ problems with modifying vertex arrays without re-setting the pointers. */
+ if(!set_current(this) && !dirty)
+ return;
+
+ Buffer *vbuf = get_buffer();
+ Bind _bind_vbuf(vbuf, ARRAY_BUFFER);
+ if(vbuf && dirty)
+ update_buffer();
+
+ const float *base = (vbuf ? reinterpret_cast<float *>(get_offset()) : &data[0]);
+ unsigned stride_bytes = stride*sizeof(float);
+ apply_arrays(&arrays, (old ? &old->arrays : 0), base, stride_bytes, use_legacy);
+}