├── README.txt ├── dependencies └── oscP5-0.9.9.zip ├── doc └── processing_mapmap_screenshot.png ├── mapmap_processing_example.mmp └── processing_mapmap_example └── processing_mapmap_example.pde /README.txt: -------------------------------------------------------------------------------- 1 | Processing - MapMap example 2 | =========================== 3 | Example of rendering Processing to MapMap using JPEG images and OSC. 4 | 5 | Author: Alexandre Quessy 6 | License: public domain 7 | Date: October 2015 8 | Syntax of this file: reStructuredText 9 | 10 | 11 | Installation 12 | ------------ 13 | Uncompress and copy the oscP5 library to your sketches folder. 14 | Run MapMap with the project:: 15 | 16 | mapmap mapmap_processing_example.mmp 17 | 18 | Run the processing sketch. 19 | 20 | -------------------------------------------------------------------------------- /dependencies/oscP5-0.9.9.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapmapteam/processing-mapmap/2a4265043bb5d587c4dfe4213baaeb55e724f4c4/dependencies/oscP5-0.9.9.zip -------------------------------------------------------------------------------- /doc/processing_mapmap_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapmapteam/processing-mapmap/2a4265043bb5d587c4dfe4213baaeb55e724f4c4/doc/processing_mapmap_screenshot.png -------------------------------------------------------------------------------- /mapmap_processing_example.mmp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1 7 | /tmp/to_mapmap_9.jpg 8 | 1 9 | 370.5 10 | 24 11 | 12 | 13 | 14 | 15 | 1 16 | 17 | false 18 | 2 19 | 2 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | false 29 | 2 30 | 2 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /processing_mapmap_example/processing_mapmap_example.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Saves the rendering of this Processing sketch and sends an OSC message to MapMap. 3 | * 4 | * Usage: 5 | * Press 's' to enable/disable frame saving to MapMap 6 | */ 7 | 8 | // CONFIGURATION: 9 | static final int MAPMAP_OSC_RECEIVE_PORT = 12345; // MapMap's default OSC receive port. 10 | static final String OSC_ADDR_SEND_HOST = "localhost"; 11 | static final int MAPMAP_MEDIA_ID = 1; // The source in MapMap 12 | static final int FPS = 24; 13 | 14 | // imports 15 | import netP5.*; 16 | import oscP5.*; 17 | 18 | // business logic variables 19 | boolean save_to_mapmap_enabled = true; // let's enable it by default 20 | int current_frame_number = 0; 21 | static final int OSC_ADDR_RECV_PORT = 18939; // useless 22 | OscP5 oscP5; 23 | NetAddress address_to_send_to; 24 | 25 | void setup() 26 | { 27 | size(320, 240, P3D); 28 | frameRate(FPS); 29 | oscP5 = new OscP5(this, OSC_ADDR_RECV_PORT); 30 | address_to_send_to = new NetAddress(OSC_ADDR_SEND_HOST, MAPMAP_OSC_RECEIVE_PORT); 31 | } 32 | 33 | String make_frame_file_name() 34 | { 35 | current_frame_number = (current_frame_number + 1) % 10; 36 | return "/tmp/to_mapmap_" + current_frame_number + ".jpg"; 37 | } 38 | 39 | void draw() 40 | { 41 | background(0, 127, 0); 42 | fill(0, 255, 0); 43 | ellipse(mouseX, mouseY, 75, 75); 44 | 45 | if (save_to_mapmap_enabled) 46 | { 47 | String file_name = make_frame_file_name(); 48 | saveFrame(file_name); 49 | send_mapmap_paint_uri(MAPMAP_MEDIA_ID, file_name); 50 | } 51 | } 52 | 53 | void send_mapmap_paint_uri(int media_id, String file_name) 54 | { 55 | OscMessage myMessage = new OscMessage("/mapmap/paint/uri"); 56 | myMessage.add(media_id); 57 | myMessage.add(file_name); 58 | oscP5.send(myMessage, address_to_send_to); 59 | } 60 | 61 | void toggle_save_to_mapmap() 62 | { 63 | save_to_mapmap_enabled = ! save_to_mapmap_enabled; 64 | } 65 | 66 | void keyPressed() 67 | { 68 | switch(key) 69 | { 70 | case 's': 71 | toggle_save_to_mapmap(); 72 | break; 73 | } 74 | } --------------------------------------------------------------------------------