I have two projects, one is using storyboard and the other doesn't, Everything works fine in storyboard based project, camera loads, targets found but in the xib based project, OpenGLView doesnt show up and my app crashes!
here is the code for my viewController:
import UIKit
class ScannerViewController: GLKViewController {
// override func loadView() {
// let glView = OpenGLView()
// self.view = glView
// }
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
if !easyar_CameraDevice.isAvailable() {
print("Camera device not available")
return
}
if !easyar_CloudRecognizer.isAvailable() {
print("Cloud recognizer not available")
return
}
let glView = self.view as! OpenGLView
glView.initialize()
glView.setOrientation(self.interfaceOrientation)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let glView = self.view as! OpenGLView
glView.start()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
let gView = self.view as! OpenGLView
gView.stop()
}
override func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) {
super.willRotate(to: toInterfaceOrientation, duration: duration)
let gView = self.view as! OpenGLView
gView.setOrientation(toInterfaceOrientation)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
here is my log:
2020-02-22 17:54:32.620731+0330 Third eye[4805:1105596] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x28072f5e0> to GL_RENDERBUFFER 1
2020-02-22 17:54:32.620888+0330 Third eye[4805:1105596] Failed to make complete framebuffer object 8cd6
2020-02-22 17:54:32.643522+0330 Third eye[4805:1105596] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2020-02-22 17:54:32.646741+0330 Third eye[4805:1105596] [MC] Reading from public effective user settings.