반응형

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup()
{
  size(400,400);
  frameRate(25);
 
  oscP5 = new OscP5(this, 12000);
 
  //ip와 포트번호를 가지고 있는 netAddress이다.
  myRemoteLocation = new NetAddress("127.0.0.1",12000);
}

void draw(){
  background(0);
}
void test1()
{
 // String s = "Test11 ";
  background(100,100,0);
  text(72,20, 80);
}
//마우스 이벤트
void mousePressed()
{
  OscMessage myMessage = new OscMessage("/test");
 
  myMessage.add(123);
  myMessage.add("hello");
 
  oscP5.send(myMessage, myRemoteLocation);
}

//메세지 리시브

void oscEvent(OscMessage theOscMessage) {
// draw1();
print(" addrpattern: "+theOscMessage.addrPattern());
}

간단한 예제이다.
소켓통신을 공부했다면 어느정도 이해가 되는 소스
oscP5 라이브러리가 도데체 뭔가 하고 헤맷었는데.
이미 내가 알고있는 사이트에서 만든 라이브러리였다.
아 진짜 바보.
약자라는걸 왜 눈치를 못챘지?

반응형

+ Recent posts