Help with a VR example (beginner)

I did the following basic test code and created 4 boxes in 3D ‘space’.
I would like to view this output using my Iphone 7, looking through a Virtual Reality (VR) headset for example, the Google cardboard.
What code changes do I need to make it VR-enabled and presume I also need to create a file of a special format and transfer it into my Iphone, ready for viewing?
Much thanks for help / tips.

Here’s the code:

def setup():
size(500,500,P3D)
translate(width/2, height/2, 0)
background(255)

rotateY(radians(120))    
fill(128) # grey box
drawbox(0,0,0)
fill(255,0,0) # red box
drawbox(150,0,0)
fill(0,255,0) # green box
drawbox(0,150,0)
fill(0,0,255) # blue box
drawbox(0,0,150)

def drawbox(x,y,z):
pushMatrix()
translate (x,y,z)
box(80)
popMatrix()

I tried importing processing.vr but it says module not found.

I found some info. on the forum and it seems to be for Android instead of IOS.
Will keep searching for an example in Processing for IOS for Google cardboard.
(The idea is if this test code works, then I’ll replace it with a more complicated image/scenes as part of my study/research which I’ve created in 2D and currently converting into 3D).
Thanks for any tips.

2 Likes