hey:
one of the problems im trying to solve is in my last post
java development is very expensive in terms of dev time and project budget
and for eai
perl could do things a lot faster
and with less difficulty
this site has java eai examples
http://tecfa.unige.ch/guides/vrml/examples/eai/
ok i havent tested these code pieces
thoughoughly but check it out
there are some differences in the way they currently work
mostly because there is no activex/pluing for perl!!
here is the java directory of code for changing rgb
http://tecfa.unige.ch/guides/vrml/examples/eai/rgb-change/
check out RGBChange.java its the core of it all
there is an html page there you should be able to load if you hava a vrml plugin:
say http://www.parallelgraphics.com/ plugin under windows
here is the perl code
# Very simple: just get the TouchSensor event and give
# a random color to the other box.
# NOTE - this does not work very well, at all!!!! Have
# to figure out how best to fix it. JAS.
$PORT=90000;
use IO::Socket;
$server = IO::Socket::INET->new(Proto => 'tcp',
LocalPort => $PORT,
Listen => SOMAXCONN,
Reuse => 1) or die("Can't set up server");
system("perl /usr/bin/freewrl t1.wrl -best -eai localhost:$PORT eai &"
+);
$sock = $server->accept();
$sock->autoflush(1);
sub getlines {
print "jt1.pl getlines starting\n";
my @arr;
for(1..$_[0]) {
print "jt1.pl EXPECTING ROW $_\n";
my $str = <$sock>;
chomp $str;
print "jt1.pl GOT '$str'\n";
push @arr, $str;
}
print "jt1.pl returning from getlines @arr\n";
return @arr;
}
# Test the sample EAI protocol.
$a = <$sock>;
$sock->print("TJL EAI CLIENT 0.02\n");
$sock->print("1\nGN TS\n");
my @l = getlines(4);
# print "\njt1.pl ok, REAL node of TS is $l[3]\n\n";
$sock->print("2\nGN MAT\n");
my @m = getlines(4);
# print "\njt1.pl ok, node of MAT is $m[3]\n\n";
# print "jt1.pl SENDING 3 RL $l[3] TouchTime XX\n";
$sock->print("3\nRL $l[3] touchTime XX\n");
my @l2 = getlines(4);
# print "jt1.pl - Touchtime returned @l2\n";
# XXX This is fragile - it breaks if user clicks quickly and two event
+s
# come before our response gets to them
while(@x = getlines(3)) {
print "jt1.pl in while loop with @x\n";
if($x[1] ne "XX") {die("Invalid ev '$x[1]'")}
$sock->print("15\nSE $m[3] diffuseColor\n".(join ' ',map {rand
+} 0..2)."\n");
#@y = getlines(4);
#print "jt1.pl finishing while loop with @y\n";
}
please keep in mind this is the first
implementation of perl eai in freewrl
no other vrml viewer/browser
has the capability of running perl...yet
hope that helps in understanding!
back in the day we didnt have no old school
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.