我使用外部渲染器创建应用程序以及如何通过请求调用重绘?例如,在Android上我可以使用requestRenderer()和RENDERMODE_WHEN_DIRTY渲染模式来完成。
我有下一个代码:
import UIKit
import GLKit
class RendererViewController: GLKViewController {
var rendererView: GLKView!
var filename: String!
override func viewDidLoad() {
super.viewDidLoad()
self.rendererView = self.view as! GLKView
self.rendererView.context = EAGLContext(API: .OpenGLES2)
self.rendererView.drawableDepthFormat = GLKViewDrawableDepthFormat.Format24
self.setupGL()
}
func setupGL(){
EAGLContext.setCurrentContext(self.rendererView.context)
RendererBridge.initLLG()
self.rendererView.bindDrawable()
let wight = self.rendererView.drawableWidth
let height = self.rendererView.drawableHeight
RendererBridge.open(Int32(wight), hei: Int32(height), filepath: filename)
RendererBridge.createRenderer(Int32(wight), hei: Int32(height))
}
deinit{
if EAGLContext.currentContext() == self.rendererView.context{
EAGLContext.setCurrentContext(nil)
}
}
override func glkView(view: GLKView, drawInRect rect: CGRect) {
RendererBridge.renderFrame()
}
}
答案 0 :(得分:0)
我已经完成了下一步:
self.pause = true
self.view.setNeedsDisplay