title: How to draw a dynamic line or curve per frame in SceneKit
body: <p>I have a Metal-backed SceneKit project where I'd like to draw a curve that is modified on the CPU every frame. This seems like it should be a simple task; one that I've done in OpenGL many times.</p>
  
  <p>Something like:</p>
  
  <pre><code>array_of_points[0].x = 25
  array_of_points[0].y = 35
  upload_array_to_gpu()
  render_frame()
  </code></pre>
  
  <p>It seems that modifying the SCNGeometrySource of an SCNNode is not possible. Recreating and setting the node.geometry works but the position lags / jitters compared to other nodes in the scene. Recreating the entire node each frame also lags.</p>
  
  <p>One possible avenue might be a geometry shader modifier, but I'd still have to somehow pass in my cpu-computed curve positions.</p>
  
  <p>Another option is to use metal APIs directly. Though this approach seems like it will require lots more code, and I couldn't find too much info about mixing SceneKit with Metal.</p>
  
  <p>I also tried setting the preferredRenderingAPI to OpenGL, but it doesn't change the renderingAPI.</p>