def init(): """ called from logic brick """ if not hasattr(logic, 'setRender'): print("ERROR: You require a patched Blender with bge.logic.setRender() method") return logic.endGame() scene = logic.getCurrentScene() camera = scene.objects.get('Camera.VR') if not camera: print("ERROR: Missing special Camera.VR object") return logic.endGame() backend = camera['backend'] hmd = HMD(backend) if not hmd.start(): return logic.endGame() """ waiting for the following fix to use logic.globalDict instead of globals https://developer.blender.org/T46870 (this is fixed, but it has not been merged in decklink yet) """ logic.hmd = hmd
def init(self, context): """ Initialize device :return: return True if the device was properly initialized :rtype: bool """ try: HMD = self._getHMDClass() self._hmd = HMD() # gather arguments from HMD self.setEye(0) self.width = self._hmd.width_left self.height = self._hmd.height_left self.setEye(1) self.width = self._hmd.width_right self.height = self._hmd.height_right # initialize FBO if not super(Oculus, self).init(): raise Exception("Failed to initialize HMD") # send it back to HMD if not self._setup(): raise Exception("Failed to setup Oculus") # set status to okay. self.status = "HMD Initialized" except Exception as E: self.error("init", E, True) self._hmd = None return False else: return True