@@ -113,6 +113,30 @@ void KinectGrabber::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchO
113113 }
114114 }
115115
116+ if (!loaded){
117+ loaded = true ;
118+ if (weHaveKinect){
119+
120+ colorCleanImage.allocate (kinectWidth, kinectHeight);
121+ cleanImage.allocate (kinectWidth, kinectHeight);
122+ grayThreshNear.allocate (kinectWidth, kinectHeight);
123+ grayThreshFar.allocate (kinectWidth, kinectHeight);
124+
125+ loadKinectSettings ();
126+
127+ static_cast <ofxKinect *>(_outletParams[2 ])->setRegistration (true );
128+ static_cast <ofxKinect *>(_outletParams[2 ])->init (isIR,true ,true );
129+ static_cast <ofxKinect *>(_outletParams[2 ])->open (deviceID);
130+ static_cast <ofxKinect *>(_outletParams[2 ])->setCameraTiltAngle (0 );
131+
132+ }
133+ }
134+
135+ }
136+
137+ // --------------------------------------------------------------
138+ void KinectGrabber::drawObjectContent (ofxFontStash *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
139+
116140 // KINECT UPDATE
117141 if (weHaveKinect && static_cast <ofxKinect *>(_outletParams[2 ])->isInitialized () && static_cast <ofxKinect *>(_outletParams[2 ])->isConnected ()){
118142 static_cast <ofxKinect *>(_outletParams[2 ])->update ();
@@ -141,29 +165,6 @@ void KinectGrabber::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchO
141165 }
142166 }
143167
144- if (!loaded){
145- loaded = true ;
146- if (weHaveKinect){
147-
148- colorCleanImage.allocate (kinectWidth, kinectHeight);
149- cleanImage.allocate (kinectWidth, kinectHeight);
150- grayThreshNear.allocate (kinectWidth, kinectHeight);
151- grayThreshFar.allocate (kinectWidth, kinectHeight);
152-
153- loadKinectSettings ();
154-
155- static_cast <ofxKinect *>(_outletParams[2 ])->setRegistration (true );
156- static_cast <ofxKinect *>(_outletParams[2 ])->init (isIR,true ,true );
157- static_cast <ofxKinect *>(_outletParams[2 ])->open (deviceID);
158- static_cast <ofxKinect *>(_outletParams[2 ])->setCameraTiltAngle (0 );
159-
160- }
161- }
162-
163- }
164-
165- // --------------------------------------------------------------
166- void KinectGrabber::drawObjectContent (ofxFontStash *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
167168 // background
168169 if (scaledObjW*canvasZoom > 90 .0f ){
169170 ofSetColor (34 ,34 ,34 );
0 commit comments