Skip to content

Commit 8b30114

Browse files
committed
first commit; working
0 parents  commit 8b30114

File tree

5 files changed

+219
-0
lines changed

5 files changed

+219
-0
lines changed

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
libs/
2+
docs/
3+
4+
*.depend
5+
*.layout
6+
*.mode*v3
7+
*.pbxuser
8+
*.app*
9+
*.DS_*
10+
._*.*
11+
12+
.svn/
13+
obj/
14+
bin/
15+
build/
16+
!data/
17+
xcuserdata/
18+
19+
ipch/
20+
*.suo
21+
*.opensdf
22+
*.vcxproj.user
23+
*.opendb
24+
25+
*.obj
26+
*.tlog
27+
*.sdf
28+
*.pdb
29+
*.idb
30+
*.pch
31+
Debug/
32+
Release/
33+
34+
35+
*~.xml
36+
37+
Sketch*/

dualNi/addons.make

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ofxNI2
2+
ofxSpout

dualNi/src/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "testApp.h"
2+
#include "ofAppGlutWindow.h"
3+
4+
//--------------------------------------------------------------
5+
int main()
6+
{
7+
ofAppGlutWindow window; // create a window
8+
// set width, height, mode (OF_WINDOW or OF_FULLSCREEN)
9+
ofSetupOpenGL(&window, 320, 240, OF_WINDOW);
10+
ofRunApp(new testApp()); // start the app
11+
}

dualNi/src/testApp.cpp

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#include "testApp.h"
2+
3+
#include "ofxNI2.h"
4+
5+
ofxNI2::Device *device;
6+
ofxNI2::Device *device2;
7+
ofxNI2::IrStream ir;
8+
ofxNI2::ColorStream color;
9+
ofxNI2::DepthStream depth, depth2;
10+
11+
//--------------------------------------------------------------
12+
void testApp::setup()
13+
{
14+
ofSetFrameRate(60);
15+
ofSetVerticalSync(true);
16+
ofBackground(0);
17+
18+
device = new ofxNI2::Device;
19+
device->setup(1);
20+
device2 = new ofxNI2::Device;
21+
device2->setup(0);
22+
23+
if (depth.setup(*device))
24+
{
25+
depth.setSize(320, 240);
26+
depth.setFps(30);
27+
depth.start();
28+
}
29+
30+
if (depth2.setup(*device2))
31+
{
32+
depth2.setSize(320, 240);
33+
depth2.setFps(30);
34+
depth2.start();
35+
}
36+
37+
if (ir.setup(*device)) // only for xtion device (OpenNI2-FreenectDriver issue)
38+
{
39+
ir.setSize(320, 240);
40+
ir.setFps(30);
41+
ir.start();
42+
}
43+
44+
// if (color.setup(*device)) // only for kinect device
45+
// {
46+
// color.setSize(320, 240);
47+
// color.setFps(60);
48+
// color.start();
49+
// }
50+
51+
sender.init("Asus1");
52+
sender2.init("Asus2");
53+
fbo.allocate(320, 240, GL_RGBA);
54+
fbo2.allocate(320, 240, GL_RGBA);
55+
}
56+
57+
void testApp::exit()
58+
{
59+
device->exit();
60+
delete device;
61+
device2->exit();
62+
delete device2;
63+
}
64+
65+
//--------------------------------------------------------------
66+
void testApp::update()
67+
{
68+
}
69+
70+
//--------------------------------------------------------------
71+
void testApp::draw()
72+
{
73+
//ir.draw();
74+
//color.draw();
75+
//depth.draw(320, 0);
76+
//depth2.draw(320, 240);
77+
78+
fbo.begin();
79+
depth.draw(0, 0);
80+
fbo.end();
81+
fbo2.begin();
82+
depth2.draw(0, 0);
83+
fbo2.end();
84+
sender.send(fbo.getTexture());
85+
sender2.send(fbo2.getTexture());
86+
}
87+
88+
//--------------------------------------------------------------
89+
void testApp::keyPressed(int key)
90+
{
91+
}
92+
93+
//--------------------------------------------------------------
94+
void testApp::keyReleased(int key)
95+
{
96+
97+
}
98+
99+
//--------------------------------------------------------------
100+
void testApp::mouseMoved(int x, int y)
101+
{
102+
103+
}
104+
105+
//--------------------------------------------------------------
106+
void testApp::mouseDragged(int x, int y, int button)
107+
{
108+
109+
}
110+
111+
//--------------------------------------------------------------
112+
void testApp::mousePressed(int x, int y, int button)
113+
{
114+
115+
}
116+
117+
//--------------------------------------------------------------
118+
void testApp::mouseReleased(int x, int y, int button)
119+
{
120+
121+
}
122+
123+
//--------------------------------------------------------------
124+
void testApp::windowResized(int w, int h)
125+
{
126+
127+
}
128+
129+
//--------------------------------------------------------------
130+
void testApp::gotMessage(ofMessage msg)
131+
{
132+
133+
}
134+
135+
//--------------------------------------------------------------
136+
void testApp::dragEvent(ofDragInfo dragInfo)
137+
{
138+
139+
}

dualNi/src/testApp.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#pragma once
2+
3+
#include "ofMain.h"
4+
#include "ofxSpout.h"
5+
6+
class testApp : public ofBaseApp
7+
{
8+
public:
9+
void setup();
10+
void exit();
11+
12+
void update();
13+
void draw();
14+
15+
void keyPressed(int key);
16+
void keyReleased(int key);
17+
void mouseMoved(int x, int y);
18+
void mouseDragged(int x, int y, int button);
19+
void mousePressed(int x, int y, int button);
20+
void mouseReleased(int x, int y, int button);
21+
void windowResized(int w, int h);
22+
void dragEvent(ofDragInfo dragInfo);
23+
void gotMessage(ofMessage msg);
24+
25+
ofxSpout::Sender sender;
26+
ofxSpout::Sender sender2;
27+
28+
ofFbo fbo;
29+
ofFbo fbo2;
30+
};

0 commit comments

Comments
 (0)