oculus experiment - processing sphere

Nikolaus Gradwohl2014-12-23T06:19:31+00:00

I got the oculus rift DK1 to play with for a view days (thanks fake!!!!) so I started experimenting a little bit - here is my first processing sketch - a reminiscence on the 3D graphics I started with on my atari ST.

To run it you need the SimpleOculusRift library for processing by xohm.

oculus rift sphere

import SimpleOculusRift.*; SimpleOculusRift o;

void setup() {
  size(1280, 800, OPENGL);
  o = new SimpleOculusRift( this, SimpleOculusRift.RenderQuality_Middle );
  o.setBknColor(200, 200, 255);
}

void draw() {
  o.draw();
}

void onDrawScene(int eye) {
  lights();
  pushMatrix();
  fill(255,0,0);
  translate(0,0,-16);
  sphere(1);
  popMatrix();
  for ( int y=0; y<40; y++) {
    for ( int x=0; x<40; x++) {
      fill( (x+y) % 2 == 0 ? 0 : 255 );
      noStroke();
      beginShape();
      vertex( (x-20)*4.0+10, -2, (y-20)*4.0 );
      vertex( (x-20)*4.0+10, -2, (y-19)*4.0 );
      vertex( (x-19)*4.0+10, -2, (y-19)*4.0 );
      vertex( (x-19)*4.0+10, -2, (y-20)*4.0 );
      endShape();
    }
  }
}

void keyPressed() {
    println("reset head orientation");
    o.resetOrientation();
}
Tweet This! submit to reddit Digg! Tags: | no comments | no trackbacks

See also:

oculus rift experiment 3 - labyrinth
oculus experiment 2 - cubes
sketch experiment 7 - osc events
nested cubes in processing
processing phaseflower

Trackbacks

Comments

Leave a response

Leave a comment