VRML: Web Cam


(world) --- (perl) ---
#VRML V2.0 utf8

NavigationInfo { type "EXAMINE" }

DEF HEART TimeSensor { cycleInterval 2  loop TRUE }

DEF SHAPE Shape { geometry Box {} }

DEF SCRIPT Script {
   directOutput TRUE
   eventIn SFTime beat
   field SFNode shape USE SHAPE
   field SFInt32 count 1
   url "vrmlscript:

function beat(val) {
   nodes = Browser.createVrmlFromString('Shape { '+
					' appearance Appearance { '+
					'   material Material {} ' +
					'   texture ImageTexture { url \"http://www.cgrg.ohio-state.edu/~mlewis/VRML/Class/w8/webPic'+count+'.jpg\" } '+
					' } '+
					'}');
   newShape = nodes[0];
   shape.appearance = newShape.appearance;
   count = count + 1;
   if(count == 4) { count = 1; }
}

"
}
ROUTE HEART.cycleTime TO SCRIPT.beat

---------------------------------------

#!/usr/local/bin/perl

$i = 1;

while(1) {
    system("vidtomem -z 1/4 2> /dev/null");
    system("imgcopy out-00000.rgb webPic".$i.".jpg 2> /dev/null");
    ++$i;  if($i==4) { $i=1; }
    sleep(2);
}



mrl