Beispiel #1
0
//--------------------------------------------------------------
void testApp::setup(){

	ofSetDataPathRoot("../Resources/");
//	ofDisableArbTex();
	
	showDepthShader.setup("showdepth");
	
	depthFBO.setup(ofGetWidth(), ofGetHeight());
	
	numObj = 100;
	for (int i = 0; i < numObj; i++) {
		float x = ofRandom(ofGetWidth()/2-200, ofGetWidth()/2+200);
		float y = ofRandom(ofGetHeight()/2-200, ofGetHeight()/2+200);
		float z = ofRandom(-200, 200);
		ofxVec3f pos = ofxVec3f(x,y,z);
		float r = ofRandom(0.0, 255.0);
		float g = ofRandom(0.0, 255.0);
		float b = ofRandom(0.0, 255.0);
		float a = ofRandom(200.0, 255.0);
		ofxVec4f col = ofxVec4f(r,g,b,a);
		int size = ofRandom(10, 50);
		objPos.push_back(pos);
		objCol.push_back(col);
		objSize.push_back(size);
	}	
}
Beispiel #2
0
//--------------------------------------------------------------
VideoManager::VideoManager(){
	
	ofSetDataPathRoot("../../../data/");
	
	//cout << "DATA PATH: " << ofToDataPath("videos/01_cropped_grade_remapped_photojpeg.mov") << endl;
	
	
	
	mov1.setPixelFormat(OF_PIXELS_RGB);
	mov2.setPixelFormat(OF_PIXELS_RGB);
	
	
	//ofDisableDataPath();
	mov1.loadMovie("videos/01_cropped_grade_remapped_photojpeg.mov");
	mov2.loadMovie("videos/01_cropped_grade_remapped_photojpeg.mov");
	//ofEnableDataPath();
	
		
	from = &mov1;
	to = &mov2;
	
	xfade = 1.0;
	framesCount = 0;
	isTransitioning = false;
	frameRendered = false;
	time = 0;
	totalFrames = mov1.getTotalNumFrames();
	frameNumber = 0;
	
	if(DEBUG) cout << "TOTAL FRAMES: " << mov1.getTotalNumFrames() << endl;


	
}
Beispiel #3
0
//--------------------------------------------------------------
int main(){
	ofAppGlutWindow window; // create a window
	// set width, height, mode (OF_WINDOW or OF_FULLSCREEN)
    ofSetupOpenGL(&window, 1280, 720, OF_WINDOW);
    ofSetDataPathRoot("../Resources/data/");
    ofRunApp(new testApp()); // start the app
}
Beispiel #4
0
//--------------------------------------
void ofRunApp(ofBaseApp * OFSA){

	OFSAptr = OFSA;
	if(OFSAptr){
		OFSAptr->mouseX = 0;
		OFSAptr->mouseY = 0;
	}
	
	#ifdef TARGET_OSX 
		//this internally checks the executable path for osx
		ofSetDataPathRoot("../../../data/");
	#endif

	atexit(ofExitCallback);

	#ifdef WIN32_HIGH_RES_TIMING
		timeBeginPeriod(1);		// ! experimental, sets high res time
								// you need to call timeEndPeriod.
								// if you quit the app other than "esc"
								// (ie, close the console, kill the process, etc)
								// at exit wont get called, and the time will
								// remain high res, that could mess things
								// up on your system.
								// info here:http://www.geisswerks.com/ryan/FAQS/timing.html

	#endif

	window->initializeWindow();

	ofSeedRandom();
	ofResetElapsedTimeCounter();

	window->runAppViaInfiniteLoop(OFSAptr);

}
Beispiel #5
0
void mareklib::setDataPathRootToAppContents() {
	char path[512];
	getcwd(path, 512);
	string dataRoot = path;
	dataRoot += "/../data/";
	ofSetDataPathRoot(dataRoot);
}
bool ofxCameraSequenceRecorder::createNewTimeStampDirectory(){

	ofSetDataPathRoot("./data/"); // relative to data

    folder_name =
    "capture-"+ofToString(ofGetYear())
    +ofToString(ofGetMonth())
    +ofToString(ofGetDay())+"-"
    +ofToString(ofGetHours())
    +ofToString(ofGetMinutes())
    +ofToString(ofGetSeconds());

   string dir = ofToDataPath(folder_name);
   cout << "\n\nCreating new directory for capture: " << dir << endl;

   File file_handle(dir);
   bool success = false;
   try{
      success = file_handle.createDirectory();
   }catch( Poco::Exception &except ){
      ofLog(OF_LOG_ERROR, "Could not make directory");
      return false;
   }

   if(success==false)ofLog(OF_LOG_WARNING, "Could not make directory because it already exists");
   return success;

}
//--------------------------------------------------------------
void arduinoGrapher::setup(){
    
    ofSetDataPathRoot("../Resources/");
    ofSetWindowTitle("Arduino Pin Grapher");
    
    cout <<ofToDataPath("verdana.ttf")<<endl;
    
    ofSetFrameRate(60); //stop hogging cpu cycles
    
    setupGui();
    setupGraphs();
    
    serial.setupDevices();
    
//    serial.println("{pin_on:a0}");
//    serial.println("{print:begin}");
    
    ofBackgroundHex(offBlack);
    
    verdana.loadFont("verdana.ttf", 12, true, true);
    verdana20.loadFont("verdana.ttf", 24, true, true);
    
    ofSetLogLevel(OF_LOG_VERBOSE);
    
//    cout << "testing string delimit function"<<endl;
//    
//    string example = "ewf[3489923]fkjewfw{12:34}{56:78}";
//    vector<string>result;
//    result = serial.unwrapDelimited(example, '{', '}');
//    
//    message message = serial.parseMessage(example);
//    
//    cout << "pin 0 is id: "<<message.pinValues[0].pin<<", value: "<<message.pinValues[0].value<<endl;
    
}
void
Java_cc_openframeworks_OFAndroid_setAppDataDir( JNIEnv*  env, jobject  thiz, jstring data_dir, jstring app_name )
{
	jboolean iscopy;
	const char *mfile = env->GetStringUTFChars(data_dir, &iscopy);
	__android_log_print(ANDROID_LOG_INFO,"OF",("Setting app dir name to: " + string(mfile)).c_str());
    ofSetDataPathRoot(string(mfile)+"/");
    string appname = env->GetStringUTFChars(app_name, &iscopy);
    __android_log_print(ANDROID_LOG_INFO,"OF",("app name: " + appname).c_str());
    if(appname!=""){
		string resources_name = ofToLower(appname + "resources.zip");
		__android_log_print(ANDROID_LOG_INFO,"OF",("uncompressing " + resources_name).c_str());
		ofFile resources(resources_name);
		__android_log_print(ANDROID_LOG_INFO,"OF",("uncompressing " + resources.getAbsolutePath()).c_str());
		if(resources.exists()){
			unzFile zip = unzOpen(resources.getAbsolutePath().c_str());
			char current_dir[1000];
			getcwd(current_dir,1000);
			chdir(ofToDataPath("",true).c_str());
			do_extract(zip,0,1,NULL);
			chdir(current_dir);

			resources.remove();
		}
    }
}
Beispiel #9
0
//-------------------------------------------------------------- SETING
void testApp::setup(){
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    ofSetVerticalSync(false);
    
    ofSetDataPathRoot("data/");
    
    ofLog(OF_LOG_NOTICE, "Loading ofxComposer");
    composer.load("config.xml");
    
    ofLog(OF_LOG_NOTICE, "Loading xml data Settings");
	data.load();
    
    ofLog(OF_LOG_NOTICE, "Loading Kinect Drivers");
    kinect.init();
    kinect.setRegistration(true);
    kinect.open();
    
    width = 640;
	height = 480;
	numPixels = width * height;
    
    ofLog(OF_LOG_NOTICE, "Allocating INPUT images");
	blobImage.allocate(width,height);
	depthFloatImage.allocate(width, height,OF_IMAGE_GRAYSCALE);
    
    ofLog(OF_LOG_NOTICE, "Starting Atmosphere");
	atmosphere.linkData(&data);
	atmosphere.allocate(width,height, data.atmosphereResolution );
	
    ofLog(OF_LOG_NOTICE, "Starting Geosphere");
	geosphere.linkData(&data);
	geosphere.allocate(width,height);
	
    ofLog(OF_LOG_NOTICE, "Starting Hydrosphere");
	hydrosphere.linkData(&data);
	hydrosphere.allocate(width,height);
	
    ofLog(OF_LOG_NOTICE, "Starting Biosphere");
	biosphere.linkData(&data);
	biosphere.allocate(width,height);
    biosphere.flock.linkData(&data);
	
    ofLog(OF_LOG_NOTICE, "Starting multi-texturing mapping");
	textures.linkData(&data);
	textures.allocate(width*2, height*2);
    
    light.setPosition(ofVec3f(0,800,-100));
	//light.setDiffuseColor(ofColor(192, 160, 128));
	cam.setDistance(3000);
    
    bEdit = false;
    bTerrain = false;
    bCalibrated = true;
    bMouse = false;
    
    ofHideCursor();
    ofSetFullscreen(true);
    composer.setEdit(false);
}
Beispiel #10
0
//========================================================================
int main( ){
	ofSetDataPathRoot("../../../data/");
	settings.load("settings/general.xml");
	
	// the width of the app is set by how many projectors we have and if we are using one screen
	// soley for the gui. The gui screen is as wide as the projectors.
	int numScreens = settings.getInt("num projectors", 1) + (settings.getBool("using first screen for gui only", false)?1:0);
	
	WIDTH =  settings.getInt("projector width", WIDTH)*numScreens;
	
	// height of the app is determined by the projector height
	HEIGHT = settings.getInt("projector height", HEIGHT);
	
	useMSAA = settings.getBool("using MSAA", false);
	ofAppGlutWindow window;
	
	if(useMSAA) {
		window.setGlutDisplayString("rgb alpha double samples depth");
	}

	ofSetupOpenGL(&window, WIDTH, HEIGHT, OF_WINDOW);			// <-------- setup the GL context

	// this kicks off the running of my app
	// can be OF_WINDOW or OF_FULLSCREEN
	// pass in width and height too:
	ofRunApp( new testApp());

}
Beispiel #11
0
//------------------------------------------------------------
void ofAppQtWindow::runAppViaInfiniteLoop(ofBaseApp * appPtr){
	static ofEventArgs voidEventArgs;

	ofAppPtr = (testApp*)appPtr;

	window = new Window(ofAppPtr);

	if(ofAppPtr){
		ofAppPtr->setup(window,window->viewCombo);
		ofAppPtr->update();
	}
	window->loadSettings();
	
    window->show();	
//	window->glWidget->appSet = true;

	ofSetDataPathRoot("../../../data/");

	
#ifdef OF_USING_POCO
	ofNotifyEvent( ofEvents.setup, voidEventArgs );
	ofNotifyEvent( ofEvents.update, voidEventArgs );
#endif
	
	qtApp->exec();



	
	
/*	glutMainLoop();*/
}
Beispiel #12
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofSetDataPathRoot("../../../../../data/");
    
    ofSetLogLevel(OF_LOG_VERBOSE);
    ofDisableArbTex();
    ofEnableDepthTest();
    ofSetVerticalSync(true);
    
    litSphere.setup();
    litSphere.loadAt(2);

    litSphere02.setup();
    litSphere02.loadAt(24);
    
    ofSetConeResolution(40, 40, 40);
    
    displacement.setup();
    
    light.setAmbientColor(ofColor(200));
    light.setDiffuseColor(ofColor(200));
    light.setSpecularColor(ofColor(200));
    ofSetSmoothLighting(true);
    
    material.setAmbientColor(ofColor(150));
    material.setDiffuseColor(ofColor(150));
    material.setSpecularColor(ofColor(150));
    material.setEmissiveColor(ofFloatColor(10.0));
    material.setShininess(0.8);
}
void
Java_cc_openframeworks_OFAndroid_setAppDataDir( JNIEnv*  env, jobject  thiz, jstring data_dir)
{
	jboolean iscopy;
	const char *mfile = env->GetStringUTFChars(data_dir, &iscopy);
	__android_log_print(ANDROID_LOG_INFO,"ofAppAndroidWindow",("setting app dir name to: \"" + string(mfile) + "\"").c_str());
    ofSetDataPathRoot(string(mfile)+"/");
}
Beispiel #14
0
//--------------------------------------------------------------
void testApp::setup(){
	ofSetDataPathRoot("../Resources/"); // pour osx, put arialbd.ttf in Resources
	receiver.setup(PORT);
	font.loadFont("arialbd.ttf", 24, true);	
	mainOutputSyphonServer.setName("Screen Output");
	ofSetFrameRate(10);
	ofBackground(0);
}
Beispiel #15
0
void ofApp::setup() {
	ofSetDataPathRoot("../../../../../SharedData/");
	ofSeedRandom(0);
	ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL_BILLBOARD);
	ofSetVerticalSync(true);
	
	int resolution = 256;
	mt.setup(resolution);
	mt.setRadius(1./resolution, 3./resolution);
	
	vector<ofVec3f> centers;
	
	model.loadModel("19.19.31-reduced.ply");//"malang-still-notime.ply");//
	ofMesh mesh = model.getMesh(0);
	cout << "input has " << mesh.getNumVertices() << " vertices in mesh 0, " << model.getNumMeshes() << " meshes total" << endl;
	
	ofVec3f lower, upper;
	getBounds(mesh, lower, upper);
	ofVec3f range = upper - lower;
	float maxDimension = MAX(range.x, MAX(range.y, range.z));
	float padding = .1;
	float scale = (1 - 2 * padding) / maxDimension;
	ofVec3f offset = -lower + padding * range;
	
	for(int i = 0; i < mesh.getNumVertices(); i++) {
		ofVec3f cur = mesh.getVertex(i);
		centers.push_back((cur + offset) * scale);
	}
	
	/*
	int n = 48;
	for(int y = 0; y < n; y++) {
		for(int x = 0; x < n; x++) {
			float z = (sin(x*TWO_PI) + cos(y*TWO_PI)) * ofSignedNoise(x, y) * .1 + .5;
			centers.push_back(ofVec3f(float(x) / n, float(y) / n, z));
		}
	}
	for(int i = 0; i < 0; i++) {
		centers.push_back(ofVec3f(ofRandomuf(), ofRandomuf(), ofRandomuf()));
	}
	*/
	
	mt.setCenters(centers);
	mt.update();
	
	ofSaveMesh(mt.getMesh(), "mt.ply");
	
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_NORMALIZE);
	glShadeModel(GL_FLAT);
	glEnable(GL_CULL_FACE);
	glCullFace(GL_BACK);
	
	//cam.init();
	ofSetSphereResolution(8);
}  
Beispiel #16
0
void ofxGLEditor::saveToFile() {

	string curPath = ofToDataPath("", false);
	#ifdef TARGET_OSX
	ofSetDataPathRoot("../../../data/scripts/");
    #endif
	string zero = "0";
	string y = ofToString(ofGetYear());
	string m = ofToString(ofGetMonth());
	if (m.size() == 1) m = zero+m;
	string d = ofToString(ofGetDay());
	if (d.size() == 1) d = zero+d;
	string hour = ofToString(ofGetHours());
	if (hour.size() == 1) hour = zero+hour;
	string min = ofToString(ofGetMinutes());
	if (min.size() == 1) min = zero+min;
	string sec = ofToString(ofGetSeconds());
	if (sec.size() == 1) sec = zero+sec;
	string ymdhms = "gamuzaScript_"+y+m+d+hour+min+sec;
	string en = ".lua";
	#ifndef __APPLE__
    string fin = "scripts/"+ymdhms+en;
    #else
    string fin = ymdhms+en;
    #endif


	string scriptPath = fin;
	string file = ofToDataPath(scriptPath);
	ofstream myfile;
	myfile.open(file.c_str(), _S_out);
	string script;
	for (unsigned int i = 0; i < glEditor.size(); i++) {
		script += wstring_to_string(glEditor[i]->GetAllText());
		script += "\n";
	}
	myfile << script;
	myfile.close();
	#ifdef TARGET_OSX
	ofSetDataPathRoot(curPath);
	#endif
	cout << "script saved" << endl;
}
Beispiel #17
0
void ofApp::setup(){
    
    ofSetDataPathRoot("../Resources/data/");
    
    setupTcp();
    setupSound();
    setupChannels();
    setupBoards();
    
}
//========================================================================
int main() {
  ofSetupOpenGL(1024, 768, OF_WINDOW);      // <-------- setup the GL context
  // os x
  ofSetDataPathRoot("../Resources/data/");
    
  // this kicks off the running of my app
  // can be OF_WINDOW or OF_FULLSCREEN
  // pass in width and height too:
  ofRunApp(new ofApp());
}
Beispiel #19
0
//--------------------------------------------------------------
void BoxWorldApp::setup(){
    ofEnableAlphaBlending();
    ofDisableArbTex();

    string data_resource_path;
#ifdef TARGET_OSX
    // Get the absolute location of the executable file in the bundle.
    CFBundleRef appBundle     = CFBundleGetMainBundle();
    CFURLRef	executableURL = CFBundleCopyExecutableURL(appBundle);
    CFURLRef	dataPrefixURL = CFBundleCopyBundleURL(appBundle);
    char execFile[4096];
    if (CFURLGetFileSystemRepresentation(executableURL, TRUE, (UInt8 *)execFile, 4096))
    {
        // Strip out the filename to just get the path
        string strExecFile = execFile;
        int found = strExecFile.find_last_of("/");
        string strPath = strExecFile.substr(0, found);
        
        // Change the working directory to that of the executable
        if(-1 == chdir(strPath.c_str())) {
            ofLog(OF_LOG_ERROR, "Unable to change working directory to executable's directory.");
        }
    }
    else {
        ofLog(OF_LOG_ERROR, "Unable to identify executable's directory.");
    }  
    CFRelease(executableURL);
    
    char dataPrefix[4096];
    if (CFURLGetFileSystemRepresentation(dataPrefixURL, TRUE, (UInt8 *)dataPrefix, 4096))
    {
        string strExecFile = dataPrefix;
        int found = strExecFile.find_last_of("/");
        string strPath = strExecFile.substr(0, found);
        data_resource_path = strPath.append("/data/");
    }
#endif
    
    /* Init according to manifest file. */
    ResourceMgrInst::get()->setRootDir(data_resource_path);

    /* Init connection manager for incoming message handling. */
    ConnMgrInst::get()->setCmdReceiver(this);
    ofSetDataPathRoot(data_resource_path);
    
    mShaderExecutor = new ShaderExecutor(BOXWORLD_WIDTH, BOXWORLD_HEIGHT);
    
    if(ResourceMgrInst::get()->isDefaultAppValid()) {
        runAppWithContent(ResourceMgrInst::get()->getDefAppContent());
    }
}
Beispiel #20
0
//--------------------------------------------------------------
void ofApp::setup(){
        
    // save temp file WITHIN app!
    ofSetWindowTitle("audioFrames");
    ofSetDataPathRoot("../Resources/data/");
    ofSetEscapeQuitsApp(false);
    
    ofBackground(0,0,0);
    recording=false;
    
    //AUDIO
    bufferSize = 1024;
    left.assign(bufferSize, 0.0);
    right.assign(bufferSize, 0.0);
    volHistory.assign(400, 0.0);
    
    bufferCounter	= 0;
    drawCounter		= 0;
    smoothedVol     = 0.0;
    scaledVol		= 0.0;
    ofSoundStreamSetup(0,NUM_CHANNELS,this, SAMPLE_RATE,BUFFER_SIZE,4);
    tempAudio = "temp.wav";
    
    recTimer = 0;
    recTimerEnd = 0;
    recFrameRate = 40;
    passFrameRate = recFrameRate;
    recFrames = 160;
    passFrames = recFrames;
    
    
    //GUI
    gui.setup("Settings"); // most of the time you don't need a name
    gui.add(frames.setup("  FRAMES TO REC", 5, 1, 100));
    gui.add(frameRate.setup("  FRAMES PER SEC", 25, 6, 60));
    gui.add(recRecord.setup("[R]ECORD"));
    gui.add(recPlay.setup("[P]LAY"));
    gui.add(recLoop.setup("[L]OOP", false));
    gui.add(recExport.setup("[S]AVE"));
    recRecord.addListener(this,&ofApp::recRecordPressed);
    //recPlay.addListener(this,&ofApp::recPlayPressed);
    recExport.addListener(this,&ofApp::recExportPressed);
    
    //AUDIO
    audioAmp = 1000.00;
    soundStream.listDevices();
    soundStream.setup(this, 0, 2, 44100, bufferSize, 4);
    
    ofHideCursor();
    
}
Beispiel #21
0
//--------------------------------------------------------------
void App::setup(){

	bgPlayer = new ofVideoPlayer();		
	
	ofSetFrameRate(fps);
	ofEnableAlphaBlending();
	ofEnableSmoothing();
	ofSetDataPathRoot("../Resources/");
	ofBackground(0,0,0);
		
	cam.position(ofGetWidth()/2, ofGetWidth()/2-400, 1000);
	//cam.setup(this, 1000);
	adminPanel.setup();
	sText.setup();	
	convexHull.setup(fps, &adminPanel, &cam);
	qImage.setup();
	httpClient.setup(&adminPanel);
	
	ofAddListener(adminPanel.onFileDialogueBG, this, &App::onFileChangeBG);	
	ofAddListener(adminPanel.onClearBG, this, &App::onClearBG);	
	ofAddListener(adminPanel.onFileDialogueQImg, this, &App::onFileChangeQImg);	
	ofAddListener(adminPanel.onClearQImg, this, &App::onClearQImg);		
	ofAddListener(adminPanel.onRestoreAllSMSAnswer, this, &App::onRestoreAllSMSAnswer);
	ofAddListener(httpClient.onSMSRecieved, this, &App::onSMSMsgRecieved);	
	ofAddListener(httpClient.onAllSMSRecieved, this, &App::onAllSMSMsgRecieved);
	ofAddListener(convexHull.yesSoft.onFinishAllUpdating, this, &App::resotoreCamOrbit);	
	ofAddListener(convexHull.noSoft.onFinishAllUpdating, this, &App::resotoreCamOrbit);
	ofAddListener(convexHull.yesSoft.notifyStartCamOrbit, this, &App::camOrbit);
	ofAddListener(convexHull.noSoft.notifyStartCamOrbit, this, &App::camOrbit);	
	bAlreadyRestoreAllAnswer = false;	
	ofAddListener(convexHull.yesSoft.notifyUpdateStextColorYesEvent, this, &App::onNotifyUpdateStextColorYesEvent);
	ofAddListener(convexHull.noSoft.notifyUpdateStextColorNoEvent, this, &App::onNotifyUpdateStextColorNoEvent);
	ofAddListener(convexHull.yesSoft.notifyStartStextFadingYesEvent, this, &App::onNotifyStartStextFadingYesEvent);
	ofAddListener(convexHull.noSoft.notifyStartStextFadingNoEvent, this, &App::onNotifyStartStextFadingNoEvent);	
	
	prevOrbit = 2;
	camOrbitAmt = 6.5;
	camOrbitDur = 600;
	camOrbitAxisY = ofxVec3f(0.0,1,0);
	camOrbitAxisN = ofxVec3f(0.0,1,0);	
	
	bCheckSetting = adminPanel.checkSetting();
	if (bCheckSetting) {
		httpClient.sendRequestToServer(true, false, true);
	}
	processAllSMS = false;

	generatedUpInfo.numTotalYes = 0;
	generatedUpInfo.numTotalNo = 0;
}
Beispiel #22
0
void ofxGLEditor::saveToFile(string _name,string _path) {

	string curPath = ofToDataPath("", false);
	ofSetDataPathRoot(_path+"/");

	string fin = _name;
	string scriptPath = fin;
	string file = ofToDataPath(scriptPath);

	ofstream myfile;
	myfile.open(file.c_str(), _S_out);
	string script;
	for (int i = 0; i < glEditor.size(); i++) {
		script += wstring_to_string(glEditor[i]->GetAllText());
		script += "\n";
	}
	myfile << script;
	myfile.close();

	ofSetDataPathRoot(curPath);
	cout << "script saved" << endl;

}
Beispiel #23
0
void ofApp::setup()
{
  ofSetDataPathRoot( __data_path__ );
  ofSetFrameRate(30);
  ofSetVerticalSync(true);
  ofSetLogLevel(OF_LOG_NOTICE);

  if ( !settings.open( "config/settings.json" ) ) 
  {
    ofLogFatalError() << "error opening settings.json";
    ofExit();
    return;
  }

  rgb_cam_name = settings["params"]["calib_kinect_rgb_stereo"]["rgb_cam_name"].asString();
  rgb_device_id = settings["params"]["calib_kinect_rgb_stereo"]["rgb_device_id"].asInt();
  rgb_width = settings["params"]["calib_kinect_rgb_stereo"]["rgb_width"].asInt();
  rgb_height = settings["params"]["calib_kinect_rgb_stereo"]["rgb_height"].asInt();
  rgb_width_draw = rgb_width / 2;
  rgb_height_draw = rgb_height / 2;

  ofLog() << "rgb size " << rgb_width << " x " << rgb_height;

  rgb_cam.setDeviceID( rgb_device_id );
  rgb_cam.initGrabber( rgb_width, rgb_height, true );

  kinect.setRegistration(true);
  // ir, rgb, texture
  kinect.init(false, true, true);
  kinect.open();

  kinect.update(); 
  rgb_cam.update();

  pix_kinect_rgb = kinect.getPixelsRef(); //copy
  pix_rgb = rgb_cam.getPixelsRef(); //copy

  calibration.init( 
      settings["params"]["calib_kinect_rgb_stereo"]["cam_pattern_path"].asString(),
      "kinect", pix_kinect_rgb, 
      rgb_cam_name, pix_rgb, 
      //load calibrated kinect intrinsics
      settings["params"]["calib_kinect_rgb_stereo"]["calib_kinect_path"].asString() );

  //window setup
  ofSetWindowShape( 
      kinect.width + rgb_width_draw, 
      rgb_height > kinect.height ? rgb_height : kinect.height );
  ofSetWindowPosition( 0, 0 );
}
Beispiel #24
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofSetDataPathRoot("../Resources/data/");
    
    ofBackground(30);
    ofSetFrameRate(60);
	ofSetVerticalSync(true);
    
    legoWhite.loadImage("legoWhite_4.png");
    legoPlatte.loadImage("legoPlatte.jpg");
    
    legoSize = 20;
    legoPixelsNumber = legoSize * legoSize;
    
}
Beispiel #25
0
//--------------------------------------------------------------
void testApp::setup(){

	ofSetDataPathRoot("../Resources/");
	ofDisableArbTex();
	ofEnableAlphaBlending();
	ofBackground(255, 255, 255);
	
	cam.setup(this, 700);
	
	defaultShader.setup("default");
	showDepthShader.setup("showdepth");
	dofShader.setup("dof");
	
	depthFBO.setup(ofGetWidth(), ofGetHeight());
	colorFBO.setup(ofGetWidth(), ofGetHeight());
	
	numObj = 100;
	for (int i = 0; i < numObj; i++) {
		float x = ofRandom(ofGetWidth()/2-200, ofGetWidth()/2+200);
		float y = ofRandom(ofGetHeight()/2-200, ofGetHeight()/2+200);
		float z = ofRandom(-500, 700);
		ofxVec3f pos = ofxVec3f(x,y,z);
		float r = ofRandom(0.0, 255.0);
		float g = ofRandom(0.0, 255.0);
		float b = ofRandom(0.0, 255.0);
		float a = ofRandom(200.0, 255.0);
		ofxVec4f col = ofxVec4f(r,g,b,a);
		int size = ofRandom(10, 50);
		objPos.push_back(pos);
		objCol.push_back(col);
		objSize.push_back(size);
	}		
	
	//.setNewColumn(true);
	gui.addTitle("Shader Setting");
	gui.addSlider("focus", focus, 0.0, 2.0);
	gui.addSlider("aspectratiox", aspectratiox, 0.0, ofGetWidth());
	gui.addSlider("aspectratioy", aspectratioy, 0.0, ofGetHeight());
	gui.addSlider("blurclamp", blurclamp, 0.0, 1.0);
	gui.addSlider("bias", bias, 0.0, 1.0);
	gui.loadFromXML();
	gui.show();	
	aspectratiox = ofGetWidth();
	aspectratioy = ofGetHeight();	
	//blurclamp = 3.0;
	//bias = 0.6;
	
}
Beispiel #26
0
//--------------------------------------------------------------
void ofApp::setup(){
    params = new ofParameterGroup();
    viz.linkApp(this);
    
    ofBackground(0);
    osc.setup(6001);
#ifndef DEBUG
    ofLog() << ofToDataPath("",true);
    ofSetDataPathRoot("../Resources/");
    ofLog() << ofToDataPath("",true);
#endif
    
    syphon.setName("HeyOF");
    
    
    ofSetFrameRate(30);
    
    outTexture.allocate(widthOut, heightOut);
    
#ifdef LEAPMOTION
    leap.open();
#endif



    params->add(*viz.params);
    
    CPARAM(alphaFade,255,0,255);
//    CPARAM(mainColor,ofColor(255,255,255,255),ofColor(0),ofColor(255))

    
   
    
    params->setName("mainParams");
    panel = new ofxPanel(*params);
    
    vizNumber = 0;
    
//    glove.init();

    
    outTexture.begin();
    ofClear(0);
    outTexture.end();
//    ofDrawRectangle(0, 0, widthOut, heightOut);
    
    
}
void ofApp::setup(){
    string strExecFile(getExecutableFile());
    int found = strExecFile.find_last_of("/");
    string strPath = strExecFile.substr(0, found) + "/data/";
    
    // Change the working directory to that of the data folder
    //chdir(strPath.c_str());
    ofSetDataPathRoot(strPath.c_str());
    fbo.allocate(ofGetWidth(), ofGetHeight());
    
    char buffer[10];
    sprintf(buffer, "%d.%03d", g_CurrPluginInfo->GetPluginExtendedInfo()->PluginMajorVersion,
            g_CurrPluginInfo->GetPluginExtendedInfo()->PluginMinorVersion);
    debugText = string("FFGL Test 2014\n plugin V") + string(buffer);

}
Beispiel #28
0
//--------------------------------------------------------------
void testApp::setup(){
    
    ofBackground(0);
    ofSetFrameRate(60);
    ofSetVerticalSync(true);
    
    ofSetDataPathRoot("../Resources/");
    image.loadImage("gedou.jpg");
    cols = image.width / blockSize;
    rows = image.height / blockSize;
    
    mesh.setMode(OF_PRIMITIVE_TRIANGLES);

    for (int y=0; y<rows; ++y) {
        for (int x=0; x<cols; ++x) {
            // 頂点
            mesh.addVertex(ofVec3f(x*blockSize, y*blockSize, 0));
            mesh.addVertex(ofVec3f((x+1)*blockSize, y*blockSize, 0));
            mesh.addVertex(ofVec3f((x+1)*blockSize, (y+1)*blockSize, 0));
            mesh.addVertex(ofVec3f((x+1)*blockSize, (y+1)*blockSize, 0));
            mesh.addVertex(ofVec3f(x*blockSize, (y+1)*blockSize, 0));
            mesh.addVertex(ofVec3f(x*blockSize, y*blockSize, 0));
            
            // テクスチャ貼る
            mesh.addTexCoord(ofVec2f(x*blockSize, y*blockSize));
            mesh.addTexCoord(ofVec2f((x+1)*blockSize, y*blockSize));
            mesh.addTexCoord(ofVec2f((x+1)*blockSize, (y+1)*blockSize));
             mesh.addTexCoord(ofVec2f((x+1)*blockSize, (y+1)*blockSize));
            mesh.addTexCoord(ofVec2f(x*blockSize, (y+1)*blockSize));
            mesh.addTexCoord(ofVec2f(x*blockSize, y*blockSize));
            
            // デフォの位置を覚えておく 無駄、多いですけどね・・・
            controlPoints.push_back(ControlPoint(x*blockSize, y*blockSize));
            controlPoints.push_back(ControlPoint((x+1)*blockSize, y*blockSize));
            controlPoints.push_back(ControlPoint((x+1)*blockSize, (y+1)*blockSize));
            controlPoints.push_back(ControlPoint((x+1)*blockSize, (y+1)*blockSize));
            controlPoints.push_back(ControlPoint(x*blockSize, (y+1)*blockSize));
            controlPoints.push_back(ControlPoint(x*blockSize, y*blockSize));

        }
    }
    
    ofSetWindowShape(image.width, image.height);
    
    status = VISIBLE;
}
Beispiel #29
0
int main( ) {
#ifdef TARGET_OSX
    //this allows to embed all the data folder inside the app bundle.
    string newRoot = "../Resources/data/";
    ofEnableDataPath();
    ofSetDataPathRoot(newRoot);
#endif

    ofSetupOpenGL(1024,768,OF_WINDOW);

    shared_ptr<mainAppController> mainApp (new mainAppController);
    shared_ptr<BYBGui> gui (new BYBGui);
    mainApp->gui = gui;
    gui->controllerPtr = mainApp;

    ofDirectory dir;
    dir.allowExt("ttf");
    dir.allowExt("otf");
    dir.listDir("fonts");
    for (int i = 0; i < dir.size(); i++ ) {
        ofTrueTypeFont f;
        if(f.load(dir.getPath(i),12, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i))] = f;
            cout << "added Font: " << ofFilePath::removeExt(dir.getName(i)) << endl;
        }
        if(f.load(dir.getPath(i),25, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i)) + "_25"] = f;
        }
    }

    try {
        ofRunApp(mainApp);
    } catch(exception& e) {
        cout << e.what() << '\n';
    }
    catch (int param) {
        cout << "int exception";
    }
    catch (char param) {
        cout << "char exception";
    }
    catch (...) {
        cout << "default exception";
    }
}
Beispiel #30
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetDataPathRoot("./");
	ofSetCircleResolution(50);
	ofBackground(0, 0, 0);
	ofSetWindowTitle("ofxOP1 example");

	ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps.
    
//    ofHideCursor();
    op1.setDimensions(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth()-200);
    
    
//    cout << "cwd is "<<getcwd()<<"\n";
    
//    verdana.loadFont("verdana.ttf",80, true, true);
    ofAddListener(op1.midiEvent, this, &testApp::op1Event);
    
}