void knt_Init(kinect_t *k, int tipo){ XnStatus nRetVal = XN_STATUS_OK; nRetVal = xnInit(&(k->pContext)); k->Node_Deep = knt_create_node_deep( k->pContext); k->Node_Image = knt_create_node_image( k->pContext, tipo); nRetVal = xnStartGeneratingAll(k->pContext); if(nRetVal != XN_STATUS_OK){ printf("Error ejecutando nodo: %s\n",xnGetStatusString(nRetVal)); } }
//////////////////////////////////////////////////////////////////////////////// // Program main //////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { int retVal = 0; retVal = xnInit( argc, argv ); printf("[ %s ]\n", sSDKsample); if (argc > 1) { cutGetCmdLineArgumenti( argc, (const char**) argv, "n", (int *) &numParticles); if (cutCheckCmdLineFlag(argc, (const char **)argv, "qatest") || cutCheckCmdLineFlag(argc, (const char **)argv, "noprompt") ) { g_bQAReadback = true; } if (cutCheckCmdLineFlag(argc, (const char **)argv, "glverify")) { g_bQAGLVerify = true; } } if (g_bQAReadback) { // For Automated testing, we do not use OpenGL/CUDA interop if ( cutCheckCmdLineFlag(argc, (const char **)argv, "device")) { cutilDeviceInit (argc, argv); } else { cudaSetDevice (cutGetMaxGflopsDeviceId() ); } g_CheckRender = new CheckBackBuffer(winWidth, winHeight, 4, false); g_CheckRender->setPixelFormat(GL_RGBA); g_CheckRender->setExecPath(argv[0]); g_CheckRender->EnableQAReadback(true); // This code path is used for Automated Testing initParticles(numParticles, false, false); initParams(); if (emitterOn) { runEmitter(); } SimParams ¶ms = psystem->getParams(); params.cursorPos = make_float3(cursorPosLag.x, cursorPosLag.y, cursorPosLag.z); psystem->step(timestep); float4 *pos = NULL, *vel = NULL; int g_TotalErrors = 0; psystem->dumpBin(&pos, &vel); g_CheckRender->dumpBin(pos, numParticles*sizeof(float4), "smokeParticles_pos.bin"); g_CheckRender->dumpBin(vel, numParticles*sizeof(float4), "smokeParticles_vel.bin"); if (!g_CheckRender->compareBin2BinFloat("smokeParticles_pos.bin", sRefBin[0], numParticles*sizeof(float4), MAX_EPSILON_ERROR, THRESHOLD)) g_TotalErrors++; if (!g_CheckRender->compareBin2BinFloat("smokeParticles_vel.bin", sRefBin[1], numParticles*sizeof(float4), MAX_EPSILON_ERROR, THRESHOLD)) g_TotalErrors++; delete psystem; delete g_CheckRender; printf("%s\n", (g_TotalErrors > 0) ? "FAILED" : "PASSED"); cudaThreadExit(); } else { // Normal smokeParticles rendering path // 1st initialize OpenGL context, so we can properly set the GL for CUDA. // This is needed to achieve optimal performance with OpenGL/CUDA interop. initGL( &argc, argv ); if ( cutCheckCmdLineFlag(argc, (const char **)argv, "device")) { cutilGLDeviceInit (argc, argv); } else { cudaGLSetGLDevice (cutGetMaxGflopsDeviceId() ); } if (g_bQAGLVerify) { g_CheckRender = new CheckBackBuffer(winWidth, winHeight, 4); g_CheckRender->setPixelFormat(GL_RGBA); g_CheckRender->setExecPath(argv[0]); g_CheckRender->EnableQAReadback(true); } // This is the normal code path for SmokeParticles initParticles(numParticles, true, true); initParams(); initMenus(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMouseFunc(mouse); glutMotionFunc(motion); glutKeyboardFunc(key); glutKeyboardUpFunc(keyUp); glutSpecialFunc(special); glutIdleFunc(idle); glutMainLoop(); } cutilExit(argc, argv); return retVal; }