Skip to content

Commit

Permalink
Revision 2.0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
leadedge committed Feb 27, 2022
1 parent aac4e7e commit 453e0d8
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 152 deletions.
45 changes: 30 additions & 15 deletions examples/MultipleSpoutReceivers/MultipleSpoutReceivers.pde
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ void setup() {
// Screen text size
textSize(16);

// Create the multiple receiving PGraphics objects
// Each PGraphics object is initialized with the size
// of the sender that the receiver connects to.
// Thereafter, the dimensions are changed to match the sender.
canvas = new PGraphics[nReceivers];
for (int i = 0; i < nReceivers; i++) {
canvas[i] = createGraphics(640, 360, P2D);
}

// Create Spout receivers to receive the frames.
receivers = new Spout[nReceivers];
Expand All @@ -37,26 +38,38 @@ void setup() {
//
// If sender names are set up here and receivers
// initialized for those names, the receivers will
// only connect to those senders
// only connect to those senders initially.
// (see MultipleSpoutSenders.pde).
//
// If the receivers ar not initialized here,
// they will be in draw when ReceiveTexture
// finds a sender. Thereafter they can connect
// to any sender that the user selects
// (see mousePressed).
// If this is not done here, the receivers are initialized
// in when ReceiveTexture finds a sender.
//
// String sendername = "Processing Spout"+i;
// receivers[i].setReceiverName(sendername);
// Thereafter, in both cases, the user can select any ender.
// (see mousePressed).
String sendername = "Processing Spout"+i;
receivers[i].setReceiverName(sendername);
//
}

}

void draw() {

background(0);
for (int i = 0; i < nReceivers; i++) {
// receiveTexture will detect a sender if the
// receiver for that quadrant is not initialized
// for a particular sender name.
canvas[i] = receivers[i].receiveTexture(canvas[i]);
if(canvas[i] != null && canvas[i].loaded) {
// Draw for successful receive
// The canvas object may have been re-sized if
// a different sender is selected for that cell
image(canvas[i], 640*(i%2), 360*(i/2), 640, 360);
}
}


/*
for (int i = 0; i < nReceivers; i++) {
// receiveTexture will detect a sender if the
// receiver for that quadrant is not initialized
Expand Down Expand Up @@ -86,12 +99,14 @@ void draw() {
}
}
}
*/

}

// SELECT A SPOUT SENDER
// RH click on the quadrant to change
// and bring up a dialog to select a sender.
// Spout installation required
// RH click on the quadrant to select a sender.
// SpoutSettings must have been run at least once
// to establish the location of "SpoutPanel".
void mousePressed() {
if (mouseButton == RIGHT) {
// Where are we
Expand Down
9 changes: 5 additions & 4 deletions examples/MultipleSpoutSenders/MultipleSpoutSenders.pde
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ color[] colors;

void setup() {

size(640, 360, P3D);
size(1280, 720, P3D);

// Create graphics objects for the senders
canvas = new PGraphics[nSenders];
for (int i = 0; i < nSenders; i++) {
canvas[i] = createGraphics(320, 180, P3D);
canvas[i] = createGraphics(640, 360, P3D);
}

colors = new color[4];
Expand All @@ -52,9 +53,9 @@ void draw() {
canvas[i].translate(canvas[i].width/2, canvas[i].height/2);
canvas[i].rotateX(frameCount * 0.01);
canvas[i].rotateY(frameCount * 0.01);
canvas[i].box(50);
canvas[i].box(150);
canvas[i].endDraw();
senders[i].sendTexture(canvas[i]);
image(canvas[i], 320 * (i % 2), 180 * (i / 2));
image(canvas[i], 640 * (i % 2), 360 * (i / 2));
}
}
56 changes: 26 additions & 30 deletions examples/SpoutDataReceiver/SpoutDataReceiver.pde
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
// IMPORT THE SPOUT LIBRARY
import spout.*;

// The first time that receiveTexure is called, the PGraphics object is
// initialized with the size of the sender that the receiver connects to.
// Thereafter, the dimensions are changed to match the sender.
PGraphics pgr; // Canvas to receive a texture
PImage img; // Image to receive a texture

// VARIABLES FOR DATA EXCHANGE
// (mouse coordinates and button status in this example)
Expand All @@ -25,7 +27,7 @@ int senderbutton = 0;
int senderpressed = 0;
int senderdragged = 0;
// String received
String senderdata = "";
String senderdata; // = "";

// DECLARE A SPOUT OBJECT
Spout spout;
Expand All @@ -42,13 +44,6 @@ void setup() {
// Processing 3+ only
surface.setResizable(true);

// Create a canvas or an image to receive the data.
// Objects can be created at any size.
// Their dimensions are changed to match the sender
// that the receiver connects to.
pgr = createGraphics(width, height, PConstants.P2D);
img = createImage(width, height, ARGB);

// A 5 integer array for received data
mousedata = new int[5];

Expand All @@ -58,18 +53,19 @@ void setup() {
// CREATE A NEW SPOUT OBJECT
spout = new Spout(this);

// Set the frame rate lower that the SpoutDataSender sketch
// to demonstrate frame sync functions.
// Set the frame rate (30) lower that the SpoutDataSender sketch (60)
// to demonstrate frame sync functions. The sender will synchronise
// with the receiver at 30fps (see setFrameSync in draw).
frameRate(30.0);

}


void draw() {

background(0);

//
// RECEIVE FROM A SENDER
//

// Receive and draw the shared texture
if(spout.receiveTexture()) {
Expand All @@ -83,30 +79,29 @@ void draw() {
//
// Method 1 (string)
//
// The content is expected (Refer to the SpoutDataSender example).
// The content format is expected (Refer to the SpoutDataSender example).
//
senderdata = spout.getSenderData();

// In this example, the received string contains
// mouse coordinates and button status.
if(senderdata.length() > 0) {

println(senderdata);
// Convert the string to integers
mousedata = int(split(senderdata, ' '));
// And the integer array to variables for legibility
if(mousedata.length >= 5) {
sendermousex = mousedata[0];
sendermousey = mousedata[1];
senderbutton = mousedata[2];
senderpressed = mousedata[3];
senderdragged = mousedata[4];
}
println(senderdata);
// Convert the string to integers
mousedata = int(split(senderdata, ' '));
// And the integer array to variables for legibility
if(mousedata.length >= 5) {
sendermousex = mousedata[0];
sendermousey = mousedata[1];
senderbutton = mousedata[2];
senderpressed = mousedata[3];
senderdragged = mousedata[4];
}
} // end string method

/*
//
// Method 1 (xml)
// Method 2 (xml)
//
// The received string is in XML format.
//
Expand Down Expand Up @@ -140,7 +135,7 @@ void draw() {
*/

//
// Method 3 - depends on what the sender produced.
// Method 3 is your own and depends on what the sender produced.
//


Expand Down Expand Up @@ -180,7 +175,7 @@ void draw() {
circle(sendermousex, sendermousey, 24);

}

// Display sender info
showInfo();

Expand Down Expand Up @@ -222,7 +217,8 @@ void mousePressed() {
// SELECT A SPOUT SENDER
if (mouseButton == RIGHT) {
// Bring up a dialog to select a sender.
// Spout installation required
// SpoutSettings must have been run at least once
// to establish the location of "SpoutPanel"
spout.selectSender();
}
}
Expand Down
6 changes: 1 addition & 5 deletions examples/SpoutDataSender/SpoutDataSender.pde
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import spout.*;

PImage img; // image to use for the rotating cube
PGraphics pgr; // Graphics for demo

// DECLARE A SPOUT OBJECT
Spout spout;
Expand All @@ -33,10 +32,7 @@ void setup() {

// Screen text size
textSize(16);

// Create a graphics object
pgr = createGraphics(1280, 720, P3D);


// Load an image
img = loadImage("SpoutLogoMarble3.bmp");

Expand Down
46 changes: 25 additions & 21 deletions examples/SpoutReceiver/SpoutReceiver.pde
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
// IMPORT THE SPOUT LIBRARY
import spout.*;

PGraphics pgr; // Canvas to receive a texture
// The first time that receiveTexure of receiveImage are called,
// the PGraphics or PImage objects are initialized with the size
// of the sender that the receiver connects to. Thereafter, the
// dimensions are changed to match the sender.
PImage img; // Image to receive a texture
PGraphics pgr; // Canvas to receive a texture

// DECLARE A SPOUT OBJECT
Spout spout;
Expand All @@ -27,13 +31,6 @@ void setup() {
// Processing 3+ only
surface.setResizable(true);

// Create a canvas or an image to receive the data.
// Objects can be created at any size.
// Their dimensions are changed to match the sender
// that the receiver connects to.
pgr = createGraphics(width, height, PConstants.P2D);
img = createImage(width, height, ARGB);

// CREATE A NEW SPOUT OBJECT
spout = new Spout(this);

Expand All @@ -42,31 +39,37 @@ void setup() {
// but you can specify the name of the sender to receive from.
// The receiver will then attempt to connect to that sender
// spout.setReceiverName("Spout Demo Sender");

}


void draw() {

background(0);

//
// RECEIVE FROM A SENDER

// OPTION 1: Receive and draw the shared texture
//

// OPTION 1: Receive and draw the texture
if(spout.receiveTexture())
spout.drawTexture();

// OPTION 2: Receive into PGraphics
// pgr = spout.receiveTexture(pgr);
// if(pgr.loaded)
// image(pgr, 0, 0, width, height);

// OPTION 3: Receive into PImage
// spout.receiveTexture(img);
// if(pgr != null)
// image(pgr, 0, 0, width, height);

// OPTION 3: Receive into PImage texture
// img = spout.receiveTexture(img);
// if(img != null)
// image(img, 0, 0, width, height);

// OPTION 4: Receive into PImage pixels
// Note that receiving pixels is slower than receiving
// a texture alone and depends on the sender size.
// img = spout.receiveImage(img);
// if(img.loaded)
// image(img, 0, 0, width, height);

// image(img, 0, 0, width, height);
// Option: resize the window to match the sender
// spout.resizeFrame();

Expand Down Expand Up @@ -105,7 +108,8 @@ void mousePressed() {
// SELECT A SPOUT SENDER
if (mouseButton == RIGHT) {
// Bring up a dialog to select a sender.
// Spout installation required
// SpoutSettings must have been run at least once
// to establish the location of "SpoutPanel"
spout.selectSender();
}
}
Expand Down
6 changes: 4 additions & 2 deletions examples/SpoutSender/SpoutSender.pde
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ void setup() {
// CREATE A NEW SPOUT OBJECT
spout = new Spout(this);

// Option - enable Spout logging to detect warnings and errors
// spout.enableSpoutLog();
// Option - enable Spout logging to detect warnings and errors.
// Note that the concolelogs will only show up in the sketch console
// window after the sketch is closed and not while the sketch is running.
// spout.enableSpoutLog();
//
// You can set the level above which the logs are shown
// 0 : SPOUT_LOG_SILENT
Expand Down
Binary file modified lib/JNISpout_32.dll
Binary file not shown.
Binary file modified lib/JNISpout_64.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions resources/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ library.version = 7

# The version as the user will see it.

library.prettyVersion = 2.0.7.2
library.prettyVersion = 2.0.7.3


# The min and max revision of Processing compatible with your Library.
Expand Down Expand Up @@ -180,7 +180,7 @@ tested.processingVersion=3.5.4

# Additional information for the generated webpage.

library.copyright=(c) 2021
library.copyright=(c) 2022
library.dependencies=none
library.keywords=texture, video, opengl

Expand Down
2 changes: 1 addition & 1 deletion resources/library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ version = 7

# The version as the user will see it. If blank, the version attribute will be
# used here. This should be a single word, with no spaces.
prettyVersion = 2.0.7.2
prettyVersion = 2.0.7.3

# The min and max revision of Processing compatible with your Library.
# Note that these fields use the revision and not the version of Processing,
Expand Down
Loading

0 comments on commit 453e0d8

Please sign in to comment.