访问冲突异常Oculus VR DK2

时间:2016-07-20 15:47:10

标签: python oculus

此python代码引发违规访问错误(最后一行):

import time
from ovrsdk import *

ovr_Initialize()
hmd = ovrHmd_Create(0)
hmdDesc = ovrHmdDesc()
ovrHmd_GetDesc(hmd, byref(hmdDesc))

错误:

  File "D:\Georgy2\mypyscripts\ovr01.py", line 12, in <module>
    ovrHmd_GetDesc(hmd, byref(hmdDesc))
WindowsError: exception: access violation reading 0x00001148

我已经安装了

的最新版本

技术信息:

Display Driver Version: 1.2.6.0
Positional Tracker Driver Version: 1.0.14.0
Intel(R) HD Graphics
        Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
HMD Firmware: 2.12
Connected to OVRService server.

代码来自https://github.com/cmbruns/pyovr

我是python的新手,(类似于C的情况)我检查了hmd和hmdDesc的值。它们不是零:

<ovrsdk.windows.wrapper.LP_struct_ovrHmdStruct object at 0x02098210>
<ovrsdk.windows.wrapper.struct_ovrHmdDesc_ object at 0x020983F0>

如何解决这个问题? (我需要简单的场景来对VR中的图像进行一些数学运算。)

P.S。我不得不问这里因为Oculus论坛不适合我。 (页面https://secure.oculus.com/login/看起来不正确)

2 个答案:

答案 0 :(得分:3)

您安装了哪个Oculus运行时版本?导入声明和您正在进行的调用使其看起来好像您正在使用this库,但是在两年内还没有更新。我不确定它是否可以与兼容DK2的运行时一起使用。

如果你在Windows上(并且只针对目标窗口),那么至少应该使用1.3运行时。如果您的目标是Linux和Mac,那么您应该使用0.8运行时,并了解它不能与运行1.3运行时的任何Windows计算机一起使用。

为了在Python中使用这些版本,您需要使用cmbruns python bindings,其中包括许多示例以及绑定。

答案 1 :(得分:1)

像@Jherico提到的那样,你的代码

# Where the heck did you get this, Dunaev? Not from https://github.com/cmbruns/pyovr
from ovrsdk import *
ovr_Initialize()
...

未使用https://github.com/cmbruns/pyovr

中的API

查看那边的示例,并执行类似

的操作
import ovr
ovr.initialize(None)
...
相关问题