The first two of them have a type size_tthat maps to Uintin Swift, and the last one GLubytethat maps to UInt8. This code initializes spriteDataas an array GLubyte, which you can pass to any C function that needs UnsafeMutablePointer<GLubyte>or UnsafePointer<GLubyte>:
let width = CGImageGetWidth(spriteImage)
let height = CGImageGetHeight(spriteImage)
var spriteData: [GLubyte] = Array(count: Int(width * height * 4), repeatedValue: 0)
What do you need to do with spriteData?
source
share