-
-
Save rmirabelli/2a5b8b9bda2d6bfa8e5bcd9fe09a1690 to your computer and use it in GitHub Desktop.
Creating buffers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// STEP 2: create data & buffer for data source | |
let vertexData: [Float] = [ | |
0.0,1.0,0.0, | |
-1.0,-1.0,0.0, | |
1.0,-1.0,0.0 | |
] | |
let dataSize = vertexData.count * MemoryLayout.stride(ofValue: vertexData[0]) // use stride instead of size, as this properly reflects memory usage. | |
let vertexArray = device?.makeBuffer(bytes: vertexData, length: dataSize, options: []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment