10 Using the Rift with Java and Python

 

This chapter covers

  • Working with the Rift in Java with JOVR
  • Using the Rift in Python using PyOVR
  • What’s needed for developing Rift applications in other languages

The Rift is being marketed as a gaming device, and gaming will likely be a big driver for initial market.  Because of this, and because of the backgrounds of the some of the original developers[1] working at Oculus, the initial SDK for interacting with the Rift was exclusively in C++.  Most big gaming engines are developed in C++, most triple-A games are written in C++, and so on.  Similarly, the early development focused on delivering features first for Windows and Direct3D, with the OpenGL API and platforms like OSX and Linux lagging in feature support and stability.  There were some attempts by developers to create non-C++ mechanisms for interacting with the Rift, either attempting to wrap the Oculus libraries or interacting with the hardware directly and attempting to reproduce the same functionality in another language.  To our knowledge, none of these have gained widespread adoption thus far. 

Requirements

JNA vs JNI vs homebrew

JOVR

API differences between JOVR and the Oculus C API

Binary files

Moving on

The project file

Example dependencies

Class declaration

Member variable declarations

Hmd handle helper method

Constructor

Destruction

OpenGL context and window creation

OpenGL initialization

Buffer swapping and message processing

Frame rendering

API differences between PyOVR and the Oculus C API

The constructor

Cleaning up

Creating our output window

Initializing OpenGL dependent stuff

Frame rendering

The main loop

The theory of alternative language bindings