We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am working on integrating the Oculus Rift SDK for use with Processing. The barrel distortion and chromatic aberration correction are handled by the SDK. So what this means is that we create a pair of off-screen framebuffers (one for each eye) via createGraphics(w, h, OPENGL)
, cast to PGraphicsOpenGL
to get their texture IDs (eyeBuffer.getTexture().glName
) and pass these to the SDK when we're done drawing to them. Then, instead of drawing to the window with image(eyeBuffer, 0, 0)
we tell the SDK that we're done and it does its thing with each of the framebuffers then draws them to the window.
In order to achieve this, I have commented out super.endDraw(clear0);
line: 629 in PJOGL. I am checked out on processing-0227-2.2.1
Is there a way to do this properly? Can we add a flag to disable what happens in endDraw? I know this is a hack, and I'm probably glazing over something important.
Please see this and the following 2 posts: https://developer.oculusvr.com/forums/viewtopic.php?f=20&t=11149&p=174575#p174526
Answers
I should add that I am using processing core as a graphics library in a Java application, but I could see building this into a library for use in the Processing IDE to get folks started with the Rift
The proper way would be to create an oculus-specific renderer where you subclass PGraphicsOpenGL and PJOGL, so you can override the methods that need to behave differently.
Hey metameta!
Any news on this project? I'm also trying to get the DK2 running with processing. I found maxOhs SimpleOculusRift and pion3ers RiftIt, but both are made for the DK1 and very early releases. I decided to work on pion3ers Code. It uses jmonkeyengine for the rendering and there is a new version of this library supporting the DK2. So it should be a matter of porting pion3ers work to the new jmonkeyengine. However, a "pure" processing-library would of course be better. How far have you come?
Best regards Thomas
Hi, sorry I'm just now seeing this. I did manage to get this working in a Java project using Processing as the graphics library. You can take a look at https://github.com/meta-meta/p5-Rift for how I integrated the Rift.
https://github.com/meta-meta/OculusRiftSandbox has some examples of what I've done with it, located here https://github.com/meta-meta/OculusRiftSandbox/tree/master/src/main/java/com/generalprocessingunit/processing/demos/vr
I use Windows and develop in IntelliJ and haven't tested on anything else. If you clone OculusRiftSandbox, cd to the cloned directory and run gradlew setup it will clone into a sibling directory a handful of other projects it depends on including a forked version of Processing which has my modifications. What I do then is import into IntelliJ specifying Gradle as my project model. Shoot me a pm if you need help getting things running.