blue
This commit is contained in:
1 parent
7bd72fc60a
commit
de36ad782c
6 files changed
+23
-18
No files matched your search
@@ -5,23 +5,23 @@ import UIKit
|
||||
func renderDeinit(_ vm: RenderVM) {
|
||||
vm.timer?.invalidate()
|
||||
vm.timer = nil
|
||||
guard eglMakeCurrentContext(&vm.glView.st) else { return }
|
||||
raybriShutdown()
|
||||
eglMakeCurrent(vm.glView.st.display, nil, nil, nil)
|
||||
eglDestroySurface(vm.glView.st.display, vm.glView.st.surface)
|
||||
eglDestroyContext(vm.glView.st.display, vm.glView.st.ctx)
|
||||
eglTerminate(vm.glView.st.display)
|
||||
}
|
||||
|
||||
func renderInit(_ vm: RenderVM) {
|
||||
// UIKit has no NSOpenGLContext: EGL/ANGLE renders into the view's layer,
|
||||
// so the layer is what the bridge needs to create its surface from.
|
||||
let layer = Unmanaged.passUnretained(vm.glView.layer).toOpaque()
|
||||
vm.glView.st.caLayer = layer;
|
||||
vm.glView.st.caLayer = layer
|
||||
|
||||
if (!eglInit(&vm.glView.st)) {
|
||||
raybriLog("ERROR Could not initialize EGL");
|
||||
}
|
||||
if (!eglResetSurface(&vm.glView.st)) {
|
||||
raybriLog("ERROR Could not reset EGL surface");
|
||||
}
|
||||
|
||||
eglMakeCurrentContext(&vm.glView.st)
|
||||
guard eglInit(&vm.glView.st) else { fatalError("ERROR Could not initialize EGL") }
|
||||
guard eglResetSurface(&vm.glView.st) else { fatalError("ERROR Could not reset EGL surface") }
|
||||
guard eglMakeCurrentContext(&vm.glView.st) else { fatalError("ERROR Could not make EGL context current") }
|
||||
|
||||
raybriInit(layer)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user