Draw 2D on top in VR mode


#1

There is the eye function for the VR mode:

https://android.processing.org/reference/vr/eye.html

here an example from the reference:

import processing.vr.*;

void setup() {
  fullScreen(STEREO);
}

void draw() {
   // draw scene...

   pushMatrix();
   eye();
   translate(0, 0, 100);
   ellipse(0, 0, 50, 50);
   popMatrix();
}

As you can see after the eye() call it is followed with a translate in the z direction.
For me to get the 0,0 coordinate in the left top corner I have to do something like:

translate(-width/2, -height/2, 1350);

But the 1350 is just guessing and will probably fail on larger or smaller screens or screen with a different aspect ratio.

Is there a proper way to go into ‘2D’?


#2

You can use hint(DISABLE_DEPTH_TEST) to write on the screen and ENABLE_DEPTH_TEST to change back again.


#3

It ain’t about that. It’s about the position of the camera and the shape of the frustum.
And that the motion doesn’t effect where it is displayed.

A bit like how you can normally use camera() to get to the default position.