Skip to content
Send the Processing screen buffer to other softwares (Currently support only to Unity3D 5+)
Branch: master
Clone or download
Lucas Cassiano Silva Lucas Cassiano Silva
Lucas Cassiano Silva and Lucas Cassiano Silva Version 1.1
Fixed package size issue with Windows 10.
Latest commit b51a18b Oct 11, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Processing Version 1.1 Oct 11, 2016
Unity
README.md Update README.md Oct 9, 2016
example_unity.png Image Example Oct 8, 2016

README.md

Processing to Unity

Render Processing Sketches Screens as an Unity Texture2D (compatible with Windows, OSX and Linux) Preview

Get Started

Download the files from the github repository:

Processing

  • Add the file ScreenBroadcast.pde to your sketch folder
  • Add the methods as showed on the example

Unity

  • Add the file ProcessingToTexture.cs to your Assets folder.
  • Create (or import) any 3D object, for example, a quad (GameObject > 3D Object > Quad)
  • Drag and drop the ProcessingToTexture.cs to the gameObject
  • Set the width and height based on the width and height from processing skecth
  • If you want run interactions on the processing sketchs, enable Unity to run on background (File > Build Settings > Player Settings... > check Run On Bakground)

Basic Example (Processing)

ScreenBroadcast sb;

void setup() {
  sb = new ScreenBroadcast();
  size(800, 800);
}

void draw() {
  //Draw things here!

  sb.BroadcastSplit(get());
  //Add some delay, change to higher values to have higher
  delay(20);
  //Anything bellow this line will be not send to Unity
}

Basic Example (Unity)

Unity example

Data Transference

This simple system sends multiple chunks of byte arrays from processing to Unity, using by default the localhost ip "127.0.0.1" at port "8051".

ScreenBroadcast Methods

Method return Parameters Role
BroadcastSplit void PImage Broadcast Splitted data (split by 4)
Broadcast void PImage Broadcast one package per time (deprecated)
getImageBytes byte[] Pimage Return the bytes from the image encoded as JPG

Example

IMAGE ALT TEXT HERE

You can’t perform that action at this time.