Skip to content

Instantly share code, notes, and snippets.

@rmirabelli
Last active March 9, 2018 20:36
Show Gist options
  • Save rmirabelli/2fe2642a39b8462e112dfbc5400f6f28 to your computer and use it in GitHub Desktop.
Save rmirabelli/2fe2642a39b8462e112dfbc5400f6f28 to your computer and use it in GitHub Desktop.
Prepare for rendering
// STEP 4: prepare our command buffer and drawable
let commandQueue = device?.makeCommandQueue()
let buffer = commandQueue?.makeCommandBuffer()
let drawable = metalLayer.nextDrawable()
// create the render pass descriptor
let rpDesc = MTLRenderPassDescriptor()
rpDesc.colorAttachments[0].texture = drawable?.texture
rpDesc.colorAttachments[0].loadAction = .clear
rpDesc.colorAttachments[0].clearColor = MTLClearColorMake(1.0, 0.0, 0.0, 1.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment