private void UpdateVertexArrayObject() { if (vertexArrayObject) { vertexArrayObject.DisposeAndKeepBuffers(); } vertexArrayObject = null; if (!mesh || !material) { return; } vertexArrayObject = new VertexArrayObject(mesh.vertexArrayObject); vertexArrayObject.ApplyWithShader(material.shader); }