diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-06-02 01:41:16 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-06-02 01:41:16 +0100 |
| commit | 5e3ad78c98cb45bb4f902207d25f4fec6a2bedaa (patch) | |
| tree | 13cb2e98f33fcad83a74f3abb717bab06e01d2a4 /src | |
| parent | 4ca02e7856d0e660906e2a0f04150fbfce70214d (diff) | |
streaming from db
Diffstat (limited to 'src')
| -rw-r--r-- | src/testApp.cpp | 19 | ||||
| -rw-r--r-- | src/testApp.h | 5 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/testApp.cpp b/src/testApp.cpp index 629ffce..3b0b9b1 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -101,29 +101,40 @@ void testApp::setup(){ for (int i=0;i<bgimg.width;i++,fi+=si,ifi-=si){ fj=0.0f; ifj=1.0f; - for (int j=0;j<bgimg.height;j++,fj+=sj,ifj-=sj){ + for (int j=0;j<bgimg.height;j++,fj+=sj,ifj-=sj){ px[(j*bgimg.width+i)*3]=(unsigned char)((ifj*((ifi*cols[0].r)+(fi*cols[1].r)))+(fj*((ifi*cols[2].r)+(fi*cols[3].r)))); px[(j*bgimg.width+i)*3+1]=(unsigned char)((ifj*((ifi*cols[0].g)+(fi*cols[1].g)))+(fj*((ifi*cols[2].g)+(fi*cols[3].g)))); px[(j*bgimg.width+i)*3+2]=(unsigned char)((ifj*((ifi*cols[0].b)+(fi*cols[1].b)))+(fj*((ifi*cols[2].b)+(fi*cols[3].b)))); } } - + bgimg.setUseTexture(true); bgimg.update(); - + icons=new ofImage[3]; + icons[0].loadImage("Phone.png"); icons[1].loadImage("iPhone.png"); icons[2].loadImage("Tablet.png"); + //create the socket and bind to port 7888 + udpConnection.Create(); + udpConnection.Bind(7888); + udpConnection.SetNonBlocking(true); + } //-------------------------------------------------------------- void testApp::update(){ - + char udpMessage[1024]; + udpConnection.Receive(udpMessage,1024); + string message=udpMessage; + if(message!=""){ + printf("%s\n",message.c_str()); + } } diff --git a/src/testApp.h b/src/testApp.h index 7331ca5..bb7e6b1 100644 --- a/src/testApp.h +++ b/src/testApp.h @@ -1,6 +1,7 @@ #include "ofMain.h" #include "obtsDevice.h" +#include "ofxNetwork.h" class testApp : public ofBaseApp{ @@ -21,6 +22,8 @@ class testApp : public ofBaseApp{ int windowWidth, windowHeight; + ofxUDPManager udpConnection; + ofCamera camera; int numLines; @@ -29,7 +32,7 @@ class testApp : public ofBaseApp{ ofImage bgimg; ofColor *cols; - + ofImage *icons; }; |
