-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloOculus.java
More file actions
38 lines (31 loc) · 884 Bytes
/
HelloOculus.java
File metadata and controls
38 lines (31 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package processing.oculus.test;
import processing.core.PApplet;
import processing.oculus.Oculus;
import processing.oculus.POculus;
import processing.opengl.PGraphicsOpenGL;
public class HelloOculus extends PApplet {
public void setup() {
size(1280, 800, Oculus.RENDERER);
}
public void draw() {
background(100, 100, 100);
//Change camera to incorporate distortion caused by Oculus
//TODO: fix in future versions
beginCamera();
camera();
translate(350,800,0);
rotateX(180);
endCamera();
//Set the modelview and projection matrices based on the
//sensor data from Oculus
POculus po = ((POculus) beginPGL());
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
po.oculusModelView.invert();
pgl.applyMatrix(po.oculusModelView);
pgl.setProjection(po.oculusProjection);
//Draw actual objects
box(100);
translate(100,100,0);
sphere(100);
}
}