hi there!
first sketch i wrote from scratch:
http://users.telenet.be/k-labs/processing/cubicVR/cubicVR5.zip
its a basic cubicVR aplication similar to quicktimeVR, 6 images are mapped on the planes of a cube.
is still need to change the controls for the camera etc... but i noticed that the edges of the planes are still visible which destroys the illusion completely...
i can't find a way of making them disappear
any tips welcome.
Code:
import processing.opengl.*;
float rotx = PI/4;
float roty = PI/4;
int s = 200;
int m = 400;
PImage a, b, c, d, e, f;
void setup() {
size(400, 400, OPENGL);
a = loadImage("V01.jpg");
b = loadImage("V02.jpg");
c = loadImage("V03.jpg");
d = loadImage("V04.jpg");
e = loadImage("V05.jpg");
f = loadImage("V06.jpg");
textureMode(IMAGE);
//smooth();
noStroke();
}
void draw() {
background(255);
translate(width/2.0, height/2.0, -100);
camera(0.0, 0.0, 0.0, // eyeX, eyeY, eyeZ
10, rotx, roty, // centerX, centerY, centerZ
0.0, 1.0, 0.0); // upX, upY, upZ
// +Z "front" face
beginShape();
texture(a);
vertex(-s, -s, s, 0, 0);
vertex( s, -s, s, m, 0);
vertex( s, s, s, m, m);
vertex(-s, s, s, 0, m);
endShape();
// -Z "back" face
beginShape();
texture(c);
vertex( s, -s, -s, 0, 0);
vertex(-s, -s, -s, m, 0);
vertex(-s, s, -s, m, m);
vertex( s, s, -s, 0, m);
endShape();
// +Y "bottom" face
beginShape();
texture(f);
vertex(-s, s, s, 0, 0);
vertex( s, s, s, m, 0);
vertex( s, s, -s, m, m);
vertex(-s, s, -s, 0, m);
endShape();
// -Y "top" face
beginShape();
texture(e);
vertex(-s, -s, -s, 0, 0);
vertex( s, -s, -s, m, 0);
vertex( s, -s, s, m, m);
vertex(-s, -s, s, 0, m);
endShape();
// +X "right" face
beginShape();
texture(b);
vertex( s, -s, s, 0, 0);
vertex( s, -s, -s, m, 0);
vertex( s, s, -s, m, m);
vertex( s, s, s, 0, m);
endShape();
// -X "left" face
beginShape();
texture(d);
vertex(-s, -s, -s, 0, 0);
vertex(-s, -s, s, m, 0);
vertex(-s, s, s, m, m);
vertex(-s, s, -s, 0, m);
endShape();
}
void mouseDragged() {
float rate = 0.1;
rotx += (pmouseY-mouseY) * rate;
roty += (mouseX-pmouseX) * rate;
}