Ejemplo n.º 1
0
bool ofxLoadImage(ofImage &img, string filename) {
  if (!ofxFileExists(filename)) {
    ofxExit("ofxLoadImage: File not found: " + filename);
    return false;
  } else {
    img.load(filename);
    return true;
  }
}
Ejemplo n.º 2
0
vector<string> ofxLoadStrings(string url) {
    //cout << "ofxLoadStrings FIXME" << endl;
    //exit(1);
    //return vector<string>(); //empty
  string filename = url; //uri.getPathAndQuery();
  vector<string> lines;
  filename = ofToDataPath(filename);
  if (!ofxFileExists(filename)) { ofLogError() << "ofxLoadStrings: File not found: " << filename; return lines; }
  ifstream f(filename.c_str(),ios::in);
  string line;
  while (getline(f,line)) lines.push_back(ofxStringRemoveBOM(ofxTrimStringRight(line)));
  f.close();
  return lines;
}
Ejemplo n.º 3
0
void testApp::setupVideo() {

    //setup textures
    rgb = new unsigned char[w*h*3];
    rgba = new unsigned char[w*h*4];
    
    // setup openni
    ni.disableSkeleton();
    ni.disableDepth();	
    
    if (ini.get("useKinect",true)) {
        ni.initWithXML();
        if (ini.get("recordKinectData",false)) {
            ni.startRecordingWhenUserIsDetected();   
        }
    } else {
        if (!ofxFileExists("KinectRecording.oni")) {
            ofLogError("KinectRecording.oni file not found.\nUse useKinect=true in .ini file to use the Kinect camera.");
            std::exit(1);
        }
        ni.initWithRecording("KinectRecording.oni");
    }
}
Ejemplo n.º 4
0
void ofxAssertFileExists(string filename, string msg) {
  ofFile file(filename);
  ofxAssert(ofxFileExists(filename), msg + ": File not found: " + filename);
}