void main() { try { KinectSample kinect; kinect.initialize(); kinect.run(); } catch ( std::exception& ex ) { std::cout << ex.what() << std::endl; } }
int main(int argc, char *argv[]) { try { kinect.initialize(); glutInitWindowPosition(100, 100); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&argc, argv); glutCreateWindow(".MQOを読み込んで表示"); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutDisplayFunc(display); glutIdleFunc(idle); Init(); glutMainLoop(); mqoDeleteModel(model); mqoCleanup(); return 0; } catch ( std::exception& ex ) { std::cout << ex.what() << std::endl; } }
void display(void) { kinect.run(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor4f(0.0f, 0.0f, 1.0f, 1.0f); for (int i = 0; i < 20; ++i){ Point(kinect.kinectX[i]-WIDTH*0.45, (kinect.kinectY[i]-HEIGHT*0.45)*(-1), 20.0); } glViewport(0, 0, WIDTH, HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //視野角,アスペクト比(ウィンドウの幅/高さ),描画する範囲(最も近い距離,最も遠い距離) gluPerspective(30.0, (double)WIDTH / (double)HEIGHT, 1.0, 10000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //視点の設定 gluLookAt(kinect.kinectX[NUI_SKELETON_POSITION_HAND_LEFT] - WIDTH / 2, (kinect.kinectY[NUI_SKELETON_POSITION_HAND_LEFT] - HEIGHT / 2)*(-1), 500.0*kinect.kinectZ[NUI_SKELETON_POSITION_HAND_LEFT], //カメラの座標 0.0, 100.0, 0.0, // 注視点の座標 0.0, 1.0, 0.0); // 画面の上方向を指すベクトル std::cout << kinect.kinectX[NUI_SKELETON_POSITION_HAND_LEFT] << std::endl; //ライトの設定 glLightfv(GL_LIGHT0, GL_POSITION, lightpos); mqoCallModel(model); glutSwapBuffers(); }
void display(void) { kinect.run(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor4f(0.0f, 0.0f, 1.0f, 1.0f); for (int i = 0; i < 20; ++i){ Point(kinect.kinectX[i], kinect.kinectY[i], 20.0); } std::cout << kinect.kinectX[NUI_SKELETON_POSITION_HAND_LEFT] << std::endl; glFlush(); }
int main(int argc, char *argv[]) { kinect.initialize(); glutInitWindowPosition(100, 100); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&argc, argv); glutCreateWindow("バウンディングスフィア"); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutDisplayFunc(display); glutIdleFunc(idle); glutTimerFunc(10, timer, 0); Init(); glutMainLoop(); return 0; }
void display(void) { kinect.run(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, WIDTH, HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //視野角,アスペクト比(ウィンドウの幅/高さ),描画する範囲(最も近い距離,最も遠い距離) gluPerspective(30.0, (double)WIDTH / (double)HEIGHT, 1.0, 2000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //視点の設定 gluLookAt(0.0, 0.0, -500.0, //カメラの座標 0.0, 0.0, 0.0, // 注視点の座標 0.0, 1.0, 0.0); // 画面の上方向を指すベクトル //ライトの設定 glLightfv(GL_LIGHT0, GL_POSITION, lightpos); //Hand.Pos.x = 500 - kinect.kinectX[NUI_SKELETON_POSITION_HAND_LEFT]; Hand.Pos.y = 130.0 - float(kinect.kinectY[NUI_SKELETON_POSITION_HAND_LEFT]) * (260.0/480.0); std::cout << Hand.Pos.y << std::endl; Hand.Draw(); drawSoundSphere(Do); drawSoundSphere(Do1); drawSoundSphere(So); drawSoundSphere(So1); drawSoundSphere(La); drawSoundSphere(La1); drawSoundSphere(So2); glutSwapBuffers(); }
int main(int argc, char *argv[]) { try { kinect.initialize(); glutInitWindowPosition(100, 100); glutInitWindowSize(WIDTH, HEIGHT); glutInit(&argc, argv); glutCreateWindow("点を描画"); glutInitDisplayMode(GLUT_RGBA); glutDisplayFunc(display); glutIdleFunc(glut_idle); Init(); glutMainLoop(); return 0; } catch ( std::exception& ex ) { std::cout << ex.what() << std::endl; } }