void setup() { ofSetDataPathRoot("../../../../../SharedData/"); ofSetVerticalSync(true); // ofSetLogLevel(OF_LOG_VERBOSE); #ifdef USE_VIDEO video.loadMovie("videos/melica.mp4"); video.play(); #else video.setup(); #ifdef USE_EDSDK video.setDeviceType(EDSDK_MKII); #endif #endif ofFbo::Settings settings; settings.width = video.getWidth(); settings.height = video.getHeight(); settings.useDepth = false; buffer.allocate(settings); ofSetBackgroundAuto(false); contours.getTracker().setPersistence(100); contours.getTracker().setMaximumDistance(100); setupGui(); osc.setup("klaus.local", 7400); }
int main() { tuioSender.setup("127.0.0.1", 3333); // Create a sample listener and controller AppListener listener; Controller controller; // Have the sample listener receive events from the controller controller.addListener(listener); // Keep this process running until Enter is pressed std::cout << "Press Enter to quit..." << std::endl; std::cin.get(); // Remove the sample listener when done controller.removeListener(listener); return 0; }
void config(int id, shared_ptr<ServerApp> server) { this->id = id; this->server = server; ofSetVerticalSync(true); ofDisableAntiAliasing(); ofBackground(0); shader.loadAuto("../../../SharedData/shader/shader"); xyzMap.loadAuto("../../../SharedData/xyzMap-" + ofToString(id) + ".exr"); xyzMap.getTexture().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST); confidenceMap.loadAuto("../../../SharedData/confidenceMap-" + ofToString(id) + ".exr"); confidenceMap.getTexture().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST); ofLog() << xyzMap.getWidth() << " x " << xyzMap.getHeight(); ofLog() << confidenceMap.getWidth() << " x " << confidenceMap.getHeight(); #ifdef USE_AUDIO oscSender.setup("localhost", 7777); setupSpeakers(); #endif }
void setup() { ofBackground(255); ofSetFrameRate(60); config.load("config.xml"); defaultLength = config.getFloatValue("cable/length/default"); minLength = config.getFloatValue("cable/length/min"); maxLength = config.getFloatValue("cable/length/max"); host = config.getValue("osc/host"); sendPort = config.getIntValue("osc/sendPort"); receivePort = config.getIntValue("osc/receive"); oscSend.setup(host, sendPort); oscReceive.setup(receivePort); local.setup("Local"); remote.setup("Remote"); zeros.setup("Zeros"); zeros.add(nwZero.setup("NW Zero")); zeros.add(neZero.setup("NE Zero")); zeros.add(seZero.setup("SE Zero")); zeros.add(swZero.setup("SW Zero")); nwZero.addListener(this, &ofApp::zeroNW); neZero.addListener(this, &ofApp::zeroNE); seZero.addListener(this, &ofApp::zeroSE); swZero.addListener(this, &ofApp::zeroSW); local.gui.loadFromFile("settings.xml"); local.gui.setPosition(10, 10); zeros.setPosition(10, 200); remote.gui.setPosition(10, 310); }
int main(int argc, char **argv) { sender.setup(HOST, PORT); XnStatus rc = XN_STATUS_OK; rc = g_Context.InitFromXmlFile(SAMPLE_XML_PATH); CHECK_RC(rc, "InitFromXml"); rc = g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator); CHECK_RC(rc, "Find depth generator"); rc = g_Context.FindExistingNode(XN_NODE_TYPE_USER, g_UserGenerator); CHECK_RC(rc, "Find user generator"); XnCallbackHandle h; g_UserGenerator.RegisterUserCallbacks(NewUser, LostUser, NULL, h); g_UserGenerator.GetSkeletonCap().SetSkeletonProfile(XN_SKEL_PROFILE_ALL); XnCallbackHandle hCalib; XnCallbackHandle hPose; g_UserGenerator.GetSkeletonCap().RegisterCalibrationCallbacks(&CalibrationStart, &CalibrationEnd, NULL, hCalib); g_UserGenerator.GetPoseDetectionCap().RegisterToPoseCallbacks(&PoseDetected, NULL, NULL, hPose); rc = g_Context.StartGeneratingAll(); CHECK_RC(rc, "StartGenerating"); xn::DepthMetaData depthMD; g_DepthGenerator.GetMetaData(depthMD); fXRes = depthMD.XRes(); fYRes = depthMD.YRes(); fMaxDepth = depthMD.ZRes(); nCutOffMin = 0; nCutOffMax = fMaxDepth; nPointerX = fXRes / 2; nPointerY = fXRes / 2; nPointerDiffX = (WIN_SIZE_X / fXRes / 2) + 1; nPointerDiffY = (WIN_SIZE_Y / fXRes / 2) + 1; if (argc == 2) { nCutOffMax = atol(argv[1]); } srand(XnUInt32(time(NULL))); glutInit(&argc, argv); glutInitDisplayString("stencil depth>16 double rgb samples=0"); glutInitWindowSize(WIN_SIZE_X, WIN_SIZE_Y); glutCreateWindow("Prime Sense Stick Figure Sample"); glutSetCursor(GLUT_CURSOR_NONE); init_opengl(); glut_helpers_initialize(); cb.passive_motion_function = MotionCallback; cb.keyboard_function = key; camera.configure_buttons(0); camera.set_camera_mode(true); camera.set_parent_rotation( & camera.trackball.r); camera.enable(); object.configure_buttons(1); object.translator.t[2] = -1; object.translator.scale *= .1f; object.trackball.r = rotationf(vec3f(2.0,0.01,0.01), to_radians(180)); object.set_parent_rotation( & camera.trackball.r); object.disable(); light.configure_buttons(0); light.translator.t = vec3f(.5, .5, -1); light.set_parent_rotation( & camera.trackball.r); light.disable(); reshaper.zNear = 1; reshaper.zFar = 100; // make sure all interactors get glut events glut_add_interactor(&cb); glut_add_interactor(&camera); glut_add_interactor(&reshaper); glut_add_interactor(&light); glut_add_interactor(&object); camera.translator.t = vec3f(0, 0, 0); camera.trackball.r = rotationf(vec3f(0, 0, 0), to_radians(0)); light.translator.t = vec3f (0, 1.13, -2.41); light.trackball.r = rotationf(vec3f(0.6038, -0.1955, -0.4391), to_radians(102)); glutIdleFunc(idle); glutDisplayFunc(display); // Per frame code is in display glutMainLoop(); return (0); }