예제 #1
0
#!/bin/env python

# file qt_pyside_app.py

import sys

from openvr.glframework.qt_pyside_app import QtPysideApp


"""
Toy PySide application for use with "hello world" examples demonstrating pyopenvr
"""


if __name__ == "__main__":
    from openvr.gl_renderer import OpenVrGlRenderer
    from openvr.color_cube_actor import ColorCubeActor
    from openvr.tracked_devices_actor import TrackedDevicesActor
    renderer = OpenVrGlRenderer()
    renderer.append(ColorCubeActor())
    renderer.append(TrackedDevicesActor(renderer.poses))
    with QtPysideApp(renderer, "PySide OpenVR color cube") as qtPysideApp:
        qtPysideApp.run_loop()
예제 #2
0
#!/bin/env python

# file hello_glfw.py

from openvr.glframework.glfw_app import GlfwApp
from openvr.gl_renderer import OpenVrGlRenderer
from openvr.color_cube_actor import ColorCubeActor
from openvr.tracked_devices_actor import TrackedDevicesActor

"""
Minimal glfw programming example which colored OpenGL cube scene that can be closed by pressing ESCAPE.
"""


if __name__ == "__main__":
    renderer = OpenVrGlRenderer(multisample=2)
    renderer.append(ColorCubeActor())
    controllers = TrackedDevicesActor(renderer.poses)
    controllers.show_controllers_only = False
    renderer.append(controllers)
    with GlfwApp(renderer, "glfw OpenVR color cube") as glfwApp:
        glfwApp.run_loop()
예제 #3
0
#!/bin/env python

# file hello_wx.py

from openvr.gl_renderer import OpenVrGlRenderer
from openvr.color_cube_actor import ColorCubeActor
from openvr.tracked_devices_actor import TrackedDevicesActor
from openvr.glframework.wx_app import WxApp
"""
Minimal wxPython programming example which colored OpenGL cube scene that can be closed by pressing ESCAPE.
"""

if __name__ == "__main__":
    renderer = OpenVrGlRenderer()
    renderer.append(ColorCubeActor())
    renderer.append(TrackedDevicesActor(renderer.poses))
    with WxApp(renderer, "wx OpenVR color cube") as app:
        app.run_loop()
예제 #4
0
#!/bin/env python

# file hello_sdl2.py


from openvr.gl_renderer import OpenVrGlRenderer
from openvr.color_cube_actor import ColorCubeActor
from openvr.glframework.sdl_app import SdlApp


"""
Minimal sdl programming example which colored OpenGL cube scene that can be closed by pressing ESCAPE.
"""


if __name__ == "__main__":
	renderer = OpenVrGlRenderer(multisample=2)
	renderer.append(ColorCubeActor())
	with SdlApp(renderer, "sdl2 OpenVR color cube") as app:
		app.run_loop()
예제 #5
0
#!/bin/env python

# file hello_qt_controllers.py

from openvr.glframework.qt5_app import Qt5App
from openvr.gl_renderer import OpenVrGlRenderer
from openvr.color_cube_actor import ColorCubeActor
from openvr.tracked_devices_actor import TrackedDevicesActor
"""
Toy PyQt5 application for use with "hello world" examples demonstrating pyopenvr
"""

if __name__ == "__main__":
    renderer = OpenVrGlRenderer(multisample=2)
    renderer.append(ColorCubeActor())
    controllers = TrackedDevicesActor(renderer.poses)
    controllers.show_controllers_only = False
    renderer.append(controllers)
    with Qt5App(renderer, "PyQt5 OpenVR color cube") as qt5_app:
        qt5_app.run_loop()
예제 #6
0
            while len(self.translation_history) > self.max_history_size:
                self.translation_history.popleft()
        
        return result

if __name__ == "__main__":
    obj = ObjMesh(open("root_997.obj", 'r'))
    # invert up/down, so brain is dorsal-up
    obj.model_matrix *= ((1,0,0,0),
                         (0,-1,0,0),
                         (0,0,-1,0),
                         (-0.5,1.5,0.5,1),
                         )
    # obj = ObjMesh(open("AIv6b_699.obj", 'r'))
    renderer = OpenVrGlRenderer(multisample=2)
    renderer.append(SkyActor())
    # renderer.append(ColorCubeActor())
    controllers = TrackedDevicesActor(renderer.poses)
    controllers.show_controllers_only = True
    renderer.append(controllers)
    renderer.append(obj)
    renderer.append(FloorActor())
    interactor = SpatialInteractor()
    with GlfwApp(renderer, "mouse brain") as glfwApp:
        while not glfw.window_should_close(glfwApp.window):
            glfwApp.render_scene()
            # Update controller drag state when buttons are pushed
            interactor.update_controller_states()
            # update_scene_geometry(interactor)

예제 #7
0
    elif t == openvr.VREvent_ButtonUntouch:
        controller.is_dragging = False


if __name__ == "__main__":
    obj = ObjMesh(open("root_997.obj", 'r'))
    # invert up/down, so brain is dorsal-up
    obj.model_matrix *= (
        (1, 0, 0, 0),
        (0, -1, 0, 0),
        (0, 0, -1, 0),
        (-0.5, 1.5, 0.5, 1),
    )
    # obj = ObjMesh(open("AIv6b_699.obj", 'r'))
    renderer = OpenVrGlRenderer(multisample=2)
    renderer.append(SkyActor())
    # renderer.append(ColorCubeActor())
    controllers = TrackedDevicesActor(renderer.poses)
    controllers.show_controllers_only = True
    renderer.append(controllers)
    renderer.append(obj)
    renderer.append(FloorActor())
    new_event = openvr.VREvent_t()
    with GlfwApp(renderer, "mouse brain") as glfwApp:
        while not glfw.window_should_close(glfwApp.window):
            glfwApp.render_scene()
            # Update controller drag state when buttons are pushed
            while openvr.VRSystem().pollNextEvent(new_event):
                check_controller_drag(new_event)
            tx1 = right_controller.check_drag(renderer.poses)
            tx2 = left_controller.check_drag(renderer.poses)