| 224 | glVertex2f ((x1),(y1)); glVertex2f ((x2),(y2)); ; |
| 225 | |
| 226 | void SceneDrawer::DrawSkeleton(XnUserID nUserId) |
| 227 | { |
| 228 | XnFloat color[3]; |
| 229 | |
| 230 | XnUInt16 numLimbs=MAX_LIMBS; |
| 231 | if(m_pUserTrackerObj->GetLimbs(nUserId,pLimbsPosArr,pConfidenceArr,numLimbs)!=XN_STATUS_OK) |
| 232 | return; // no limbs to draw |
| 233 | if(numLimbs==0) |
| 234 | return; // no limbs to draw |
| 235 | XnStatus res=m_pUserTrackerObj->GetUserColor(nUserId,color); |
| 236 | if(res!=XN_STATUS_OK) |
| 237 | return; // bad user! |
| 238 | |
| 239 | glColor4f(1-color[0], 1-color[1], 1-color[2], 1); |
| 240 | for(XnUInt16 j=0; j<numLimbs; j++) |
| 241 | { |
| 242 | #ifndef USE_GLES |
| 243 | if(pConfidenceArr[j]<=0.5) |
| 244 | { |
| 245 | if(m_bShowLowConfidence==FALSE) |
| 246 | { |
| 247 | continue; // we simply do not show this limb... |
| 248 | } |
| 249 | glEnable(GL_LINE_STIPPLE); |
| 250 | if(pConfidenceArr[j]==0.5) |
| 251 | { |
| 252 | glLineStipple(1,0x0101); |
| 253 | } |
| 254 | else |
| 255 | { |
| 256 | glLineStipple(1,0x00FF); |
| 257 | } |
| 258 | } |
| 259 | glBegin(GL_LINES); |
| 260 | glVertex2f(pLimbsPosArr[j*2].X, pLimbsPosArr[j*2].Y); |
| 261 | glVertex2f(pLimbsPosArr[(j*2)+1].X, pLimbsPosArr[(j*2)+1].Y); |
| 262 | glEnd(); |
| 263 | if(pConfidenceArr[j]<=0.5) |
| 264 | { |
| 265 | glDisable(GL_LINE_STIPPLE); |
| 266 | } |
| 267 | #else |
| 268 | GLfloat verts[4] = {pLimbsPosArr[j*2].X, pLimbsPosArr[j*2].Y, pLimbsPosArr[(j*2)+1].X, pLimbsPosArr[(j*2)+1].Y}; |
| 269 | glVertexPointer(2, GL_FLOAT, 0, verts); |
| 270 | glDrawArrays(GL_LINES, 0, 2); |
| 271 | glFlush(); |
| 272 | #endif |
| 273 | } |
| 274 | #ifndef USE_GLES |
| 275 | // glEnd(); |
| 276 | #endif |
| 277 | } |
| 278 | |
| 279 | void SceneDrawer::ExitSample(int exitCode) |
| 280 | { |
no test coverage detected