tracker = psmove.PSMoveTracker() tracker.set_mirror(True) def to_glfloat(l): return (GLfloat * len(l))(*l) def read_matrix(m): return [m.at(i) for i in range(4 * 4)] near_plane = 1.0 far_plane = 100.0 fusion = psmove.PSMoveFusion(tracker, near_plane, far_plane) projection_matrix = read_matrix(fusion.get_projection_matrix()) move = psmove.PSMove() move.enable_orientation(True) move.reset_orientation() class Texture: def __init__(self): self.id = glGenTextures(1) self.bind() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) self.unbind()
from OpenGL.GL import * from OpenGL.GLUT import * import psmove glutInit(sys.argv) tracker = psmove.PSMoveTracker() tracker.set_mirror(True) def load_matrix(mode, matrix): glMatrixMode(mode) glLoadMatrixf((GLfloat * 16)(*[matrix.at(i) for i in range(16)])) fusion = psmove.PSMoveFusion(tracker, 1, 1000) projection_matrix = fusion.get_projection_matrix() move = psmove.PSMove() move.enable_orientation(True) move.reset_orientation() while tracker.enable(move) != psmove.Tracker_CALIBRATED: pass class CameraTexture: def __init__(self, tracker): self.tracker = tracker self.id = glGenTextures(1)