Virtual Reality Centring an Image SOLVED

So I have a basic processing VR script for the daydream headset, I have it below.

import processing.vr.*;
PImage title;
void setup() {
  fullScreen(STEREO);
  title = loadImage("title.png");
  title.resize(width/2,height/2);
}

void draw() {
  background(0);
  translate(width/2, height/2);
  image(title,0,0);
}

The image always shows up really far down and I’m not sure what to do to get it to the center. Does anyone know how to get an image to the center?

UPDATE: Fixed it. If anyone has a similar problem do the following:

import processing.vr.*;
PImage title;
void setup() {
  fullScreen(STEREO);
  title = loadImage("title.png");
  title.resize(width/2,height/2);
}

void draw() {
  background(0);
  imageMode(CENTER);
  translate(width/2, height/2);
  image(title,0,0);
}
1 Like

Thanks for sharing your solution :+1:

Thanks for sharing!
btw, in addition to this, does anyone know how to ignore the tilt of the phone on application launch when you deal with images?
I mean, if I place an image in my vr-app, it aligns and displays correctly only if I keep my phone right in front of eyes (landscape orientation and 90 degrees) before it starts. Otherwise, it can moves left/right/up/down depend on the tilt angle of the device which was on the launch time, (when you see “place your phone into your cardboard” splash screen)