我正在尝试在Xcode 6 OS X Swift Playground中使用GLKit,但是
import GLKit
似乎还不足以让Playground识别GLKView。有任何想法吗?
import Cocoa
import GLKit
import OpenGL
let frame = CGRect(x: 0, y: 0, width: 400, height: 300)
class TriangleView: GLKView { // ERROR: Use of undeclared type 'GLKView'
override func drawRect(dirtyRect: NSRect) {
glClearColor(0.0, 0.0, 0.1, 1.0)
}
}
您可以创建iOS项目,并在该项目内添加新的.playground文件。然后可以导入GLkit,我还必须导入OpenGLES而不是OpenGL。
import UIKit
import GLKit
import OpenGLES
let frame = CGRect(x: 0, y: 0, width: 400, height: 300)
class TriangleView: GLKView { // ERROR: Use of undeclared type 'GLKView'
override func drawRect(dirtyRect: CGRect) {
glClearColor(0.0, 0.0, 0.1, 1.0)
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句