setVertexBuffer method

void setVertexBuffer(
  1. int slot,
  2. GPUBuffer buffer, [
  3. int offset,
  4. int size,
])

A vertex buffer into a slot, optionally a window into it.

offset and size are what a backend packing several meshes into one buffer lives on. Left out they are the whole buffer, which is right for one mesh per allocation and silently wrong the moment two share — the draw succeeds and reads somebody else's geometry. GeometryBuffer carries offsetInBytes and lengthInBytes for exactly this, so the two are here rather than assumed to be zero.

Implementation

external void setVertexBuffer(
  int slot,
  GPUBuffer buffer, [
  int offset,
  int size,
]);