Skip to content

Instantly share code, notes, and snippets.

@rmirabelli
Last active March 9, 2018 20:35
Show Gist options
  • Save rmirabelli/f1121bad8bfe0840b2f932ffd7f0d30f to your computer and use it in GitHub Desktop.
Save rmirabelli/f1121bad8bfe0840b2f932ffd7f0d30f to your computer and use it in GitHub Desktop.
Create our commands and show the buffer
// STEP 5: create a buffer of actual render commands
let encoder = buffer?.makeRenderCommandEncoder(descriptor: rpDesc)
encoder?.setRenderPipelineState(renderPipeline!)
encoder?.setVertexBuffer(vertexArray, offset: 0, index: 0)
encoder?.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 3)
encoder?.endEncoding()
// show the buffer.
if let drawable = drawable {
buffer?.present(drawable)
buffer?.commit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment