Advertisement
BrandonLittell

Untitled

Dec 31st, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. import codeanticode.syphon.*; // import the Syphon library
  2.  
  3. SyphonServer server; // create the Syphon server object itself
  4. PGraphics canvas; // create a PGraphics object "canvas" - this will be what the syphon server sends
  5. PFont helvetica; // create a font object
  6.  
  7. void settings() {
  8. size (1050,160,P2D); // Set the processing window to size, using the 2D renderer
  9. PJOGL.profile=1; // OpenGL Profile 1
  10. }
  11. // The setup function gets executed once: when the sketch first starts
  12. void setup() {
  13. canvas = createGraphics(width, height,P2D); // Initialise the syphon server's canvas to the same size as the processing window
  14. frameRate(30); // Set 30fps (Processing default is 60)
  15. helvetica = createFont ("Helvetica", 200); // Set the font object to 200pt Helvetica
  16. server = new SyphonServer(this, "countdown"); // Start the Syphon server
  17. }
  18.  
  19. // The draw function gets executed once every frame (in our case 30 times a second)
  20. void draw() {
  21. canvas.beginDraw(); // begin drawing on the Syphon canvas
  22. canvas.background(0,0,0,0); // Set the background of the Syphon canvas to black with full transparency (R,G,B,A);
  23. canvas.textFont(helvetica); // Set the font to our Helvetica object
  24. canvas.text (nf(23-hour(), 2)+":"+nf(59-minute(), 2)+":"+nf(59-second(), 2)+"."+nf(int(1000-System.currentTimeMillis()%1000), 3).substring(0, 2), 0, 150);
  25. canvas.endDraw(); // finished drawing
  26. background(0,0,0,0); // Set the background of the processing sketch to black with full transparency
  27. image(canvas,0,0); // draw the Syphon canvas to the Processing window so we can see it
  28. server.sendImage(canvas); // Send the frame to the Syphon server
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement