Created
June 24, 2018 18:26
-
-
Save nocarryr/1eeec1c882019145cc465fd8f3436ca4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codeanticode.syphon.*; | |
PGraphics srcCanvas; | |
PGraphics dstCanvas; | |
boolean srcReady; | |
SyphonClient client; | |
SyphonServer server; | |
void setup() | |
{ | |
size(400, 400, P3D); | |
srcReady = false; | |
srcCanvas = createGraphics(3840, 2160, P3D); | |
dstCanvas = createGraphics(3172, 768, P3D); | |
//client = new SyphonClient(this, "Syphon2NDIClient"); | |
client = new SyphonClient(this); | |
server = new SyphonServer(this, "scalerOutput"); | |
} | |
void draw(){ | |
if (client.newFrame()){ | |
srcCanvas = client.getGraphics(srcCanvas); | |
srcReady = true; | |
} | |
if (srcReady){ | |
dstCanvas.beginDraw(); | |
dstCanvas.image(srcCanvas, 0, 0, dstCanvas.width, dstCanvas.height); | |
dstCanvas.endDraw(); | |
server.sendImage(dstCanvas); | |
} | |
background(0); | |
textSize(32); | |
textAlign(LEFT, TOP); | |
text(str(frameRate), 10, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment