// Handle a new Message void XnVPointDrawer::Update(XnVMessage* pMessage) { // PointControl's Update calls all callbacks for each hand XnVPointControl::Update(pMessage); if (m_bDrawDM) { // Draw depth map xn::DepthMetaData depthMD; m_DepthGenerator.GetMetaData(depthMD); DrawDepthMap(depthMD); } #ifdef USE_GLUT if (m_bFrameID) { // Print out frame ID xn::DepthMetaData depthMD; m_DepthGenerator.GetMetaData(depthMD); DrawFrameID(depthMD.FrameID()); } #endif // Draw hands Draw(); m_TouchingFOVEdge.clear(); }
// this function is called each frame void glutDisplay (void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Setup the OpenGL viewpoint glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); xn::SceneMetaData sceneMD; xn::DepthMetaData depthMD; g_DepthGenerator.GetMetaData(depthMD); #ifdef USE_GLUT glOrtho(0, depthMD.XRes(), depthMD.YRes(), 0, -1.0, 1.0); #elif defined(USE_GLES) glOrthof(0, depthMD.XRes(), depthMD.YRes(), 0, -1.0, 1.0); #endif glDisable(GL_TEXTURE_2D); if (!g_bPause) { // Read next available data g_Context.WaitOneUpdateAll(g_DepthGenerator); } if (g_bStep) { g_bStep = false; g_bPause = true; } // Process the data //DRAW g_DepthGenerator.GetMetaData(depthMD); g_SceneAnalyzer.GetMetaData(sceneMD); DrawDepthMap(depthMD, sceneMD); #ifdef USE_GLUT if (g_bPrintFrameID) { DrawFrameID(depthMD.FrameID()); } #endif #ifdef USE_GLUT glutSwapBuffers(); #endif }
// Handle a new Message void XnVPointDrawer::Update(XnVMessage* pMessage) { // PointControl's Update calls all callbacks for each hand XnVPointControl::Update(pMessage); if (m_bDrawDM) { // Draw depth map xn::DepthMetaData depthMD; m_DepthGenerator.GetMetaData(depthMD); DrawDepthMap(depthMD); } if (m_bFrameID) { // Print out frame ID xn::DepthMetaData depthMD; m_DepthGenerator.GetMetaData(depthMD); DrawFrameID(depthMD.FrameID()); } // Draw hands Draw(); }