Guest User

Erdem Yildirimer

a guest
Apr 18th, 2009
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. import JMyron.*;
  2. import processing.opengl.*;
  3. import pARToolKit.SimpleARToolKit;
  4. import net.obxlabs.romefeeder.*; //romefeeder..................................................
  5. import com.sun.syndication.feed.synd.*; //ROME .................................................
  6. JMyron m;
  7. PImage img;
  8. SimpleARToolKit ar;
  9. int capWidth, capHeight;
  10. Feeder feeder; // the feeder..............................................
  11. SyndEntry entry; // feed entry..............................................
  12. PFont font;//..............................................
  13.  
  14. void setup() {
  15. font = loadFont("Arial-Black-16.vlw");//..............................................
  16. textFont(font);//..............................................
  17. size(640, 480, OPENGL);
  18. capWidth = 320;
  19. capHeight = 240;
  20. m = new JMyron();
  21. m.start(capWidth, capHeight);
  22. m.findGlobs(0);
  23. img = createImage(capWidth, capHeight, ARGB);
  24. ar = new SimpleARToolKit(this, capWidth, capHeight);
  25. ar.loadPattern("patt.kanji", 80, 0.0f, 0.0f);
  26. ar.register("showBox");
  27. stroke(200,200,0);
  28.  
  29. //create the feeder
  30. feeder = new Feeder();
  31. //set the callback that is called after a feed is loaded
  32. feeder.setLoadCallback(new FeederCallback() {
  33. public void event(SyndFeed feed) {
  34. while(feeder.hasNext()) {
  35. entry = feeder.next();
  36. }
  37. }
  38. });
  39.  
  40. //load the feed
  41. feeder.load("http://twitter.com/statuses/user_timeline/15967635.rss");
  42.  
  43. //clear the background
  44. //background(0);
  45. }
  46.  
  47.  
  48. void draw() {
  49. //background(0);
  50. if (entry != null){
  51. println(entry.getTitle());
  52. String s1=entry.getTitle();
  53. println(s1.length());
  54. println(s1.endsWith("http://twitpic.com/20cdl"));
  55.  
  56. //noLoop();
  57. }
  58. m.update();
  59. m.imageCopy(img.pixels);
  60. img.updatePixels();
  61. hint(DISABLE_DEPTH_TEST);
  62. image(img,0,0,width,height);
  63. hint(ENABLE_DEPTH_TEST);
  64. if (ar.findMatch(img,100)) {
  65. ar.showObject();
  66. }
  67. }
  68.  
  69. void showBox(SimpleARToolKit _a) {
  70. noFill();
  71. //box(50);
  72. String s1=entry.getTitle();
  73. text(s1,10,20);
  74. fill(255);
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
Advertisement
Add Comment
Please, Sign In to add comment