Exemplo n.º 1
0
Boid::Boid() {
	//Set the variable in case the flock don´t set them
	space = new Space();
	space->xLeft = -ofGetScreenWidth()*0.5;
	space->xRight = ofGetScreenWidth()*0.5;
	space->yTop = -ofGetScreenHeight()*0.5;
	space->yBottom = ofGetScreenHeight()*0.5;
	space->zFront = -500;
	space->zBack = 500;
	
    color.set(255,0,0);
    
    set(ofRandom(space->xLeft, space->xRight),
        ofRandom(space->yTop, space->yBottom),
        ofRandom(space->zFront,space->zBack));
    
	vel.set(ofRandom(-0.1,0.1),
            ofRandom(-0.1,0.1),
            ofRandom(-0.1,0.1));
	acc.set(0,0,0);
    
    
	sc = ofRandom(1,3);
    maxspeed = ofRandom(0.25,0.75);
    neighborhoodRadius = 70*sc;
    maxforce = 0.1;
	
	selected	= false;
	wanderTheta = 0.1;
}
Exemplo n.º 2
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofPushMatrix();
    buffer.begin();
        if(clearBackground) ofClear(0);
        if(drawBackground) {
            ofImage* bg = (*images)[gui->getMatrix("SOCIAL MEDIA")->getSelected()[0]];
            bg->draw(buffer.getWidth()/2 - bg->getWidth()/2, buffer.getHeight()/2 - bg->getHeight()/2);
        }
        ofScale(buffer.getWidth()/scaledImage.getWidth(), buffer.getHeight()/scaledImage.getHeight());
        if(drawCamera) scaledImage.draw(0, 0);
        if(drawSparkles) {
                particles.draw(gui->getSlider("RESOLUTION")->getValue(), gui->getSlider("RESOLUTION")->getValue());
        }
    buffer.end();
    ofPopMatrix();
    gui->draw();
    ofPushMatrix();
        ofTranslate(ofGetScreenWidth(), 0);
        buffer.draw(0, 0);
    ofPopMatrix();
    ofPushMatrix();
        ofTranslate(ofGetScreenWidth()/2 - PREVIEW_WIDTH/2, ofGetScreenHeight()/2 - PREVIEW_HEIGHT/2);
        buffer.draw(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
        ofNoFill();
        ofDrawRectangle(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
    ofPopMatrix();
}
Exemplo n.º 3
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetLogLevel(OF_LOG_VERBOSE);
    ofSetWindowShape(ofGetScreenWidth(), ofGetScreenHeight());
    ofBackground(0, 0, 0);
    ofSetFrameRate(60);
	ofSetVerticalSync(true);
	
	glEnable(GL_DEPTH_TEST);
	//ofEnableLighting();
	eachWidth = ofGetScreenWidth()/NUM_DEVICE;
	timeline.setup();
    timeline.setWidth(ofGetScreenWidth());
	
	timeline.setLoopType(OF_LOOP_NORMAL);
    timeline.enableSnapToBPM(120.f);
	timeline.enableDrawBPMGrid(true);
    waveform.setup();
	waveform.loadSoundfile("6)219 - Howlin' Wolf - Spoonful (full).wav");
    timeline.setDurationInSeconds(waveform.getDuration());
    timeline.addElement("Track", &waveform);	
	
    for(int i = 0 ; i < NUM_DEVICE ; i++)
    {
        
        string device_name = "Device_"+ofToString(i,0);
        //timeline.addPage(device_name+" Page");
        //timeline.addKeyframes(device_name+"_birghtness",    device_name+"birghtness.xml",   ofRange(0, 255));
        timeline.addKeyframes(device_name+"_Red",           device_name+"Red.xml",          ofRange(0, 255));
        timeline.addKeyframes(device_name+"_Green",          device_name+"Green.xml",        ofRange(0, 255));
        timeline.addKeyframes(device_name+"_Blue",           device_name+"Blue.xml",         ofRange(0, 255));
        
    }
    
	
	timeline.getColors().loadColors("defaultColors.xml");
    timeline.setCurrentPage(1);
	ofAddListener(ofxTLEvents.trigger, this, &testApp::receivedTrigger);
    
    
    //setup serial
    serial.listDevices();
	vector <ofSerialDeviceInfo> deviceList = serial.getDeviceList();
	
	//----------------------------------- note:
	// < this should be set
	// to whatever com port
	// your serial device is
	// connected to.
	// (ie, COM4 on a pc, /dev/tty.... on linux, /dev/tty... on a mac)
	// arduino users check in arduino app....
	ofxXmlSettings xml("config.xml");
	
    serial.setup(xml.getValue("DEVICE", "/dev/tty.usbserial-11U3V4KS"), 57600);
    //serial.setup("/dev/tty.usbserial-A4001JgX", 57600);
	//serial.setup("/dev/tty.usbserial-11U3V4KS", 57600);
    serial.setVerbose(false);
    //startThread();
    //ofThread::verbose = false;
    //serial.setVerbose(false);
}
Exemplo n.º 4
0
//--------------------------------------------------------------
void testApp::setup(){ 
  //// utils
  char tmpstr[2000];
  ofFile f = ofFile();
  ofDirectory dir = ofDirectory();
  /// indexes
	rota = 0;
  nimg = 0;
  nsnd = 9;
  image_duration = 0.1;
  image_timer = 0;
  silence_timer = 0;
  silence_trigger = false;
  //// LOAD IMAGES
  string rep_images = "intelligentsia/images/";
  dir.open(rep_images);
  dir.allowExt("jpg");
  dir.listDir();
  Nimgs = dir.numFiles();
  cout << Nimgs << endl;
  
  for (int i = 0; i < Nimgs; i++){
    sprintf(tmpstr, "%s_%dx%d.jpeg",dir.getPath(i).c_str(), ofGetScreenWidth(), ofGetScreenHeight());

    if (f.doesFileExist(tmpstr)) images[i].loadImage(tmpstr);
    else {
      images[i].loadImage(dir.getPath(i));
      pt = scaleSize(images[i].width, images[i].height, ofGetScreenWidth(), ofGetScreenHeight());
      images[i].resize(pt.x,pt.y);
      cout << "will save" << tmpstr << endl;
      images[i].saveImage(tmpstr);
    }
    cout << dir.getPath(i) << endl;
  };

  //// LOAD SOUND
  string rep_sounds = "intelligentsia/sons/";
  dir.open(rep_sounds);
  dir.allowExt("wav");
  dir.listDir();
  Nsnds = dir.numFiles();
  cout << Nsnds << endl;
  
  for (int i = 0; i < Nsnds; i++){
      sounds[i].loadSound(dir.getPath(i));
      cout << dir.getPath(i) << endl;
  };
  sounds[nsnd].play();


  // GRAPHICS
  ofHideCursor();
  ofSetFrameRate(120);
  ofSetVerticalSync(true);

}
Exemplo n.º 5
0
//--------------------------------------------------------------
void testApp::setup(){

    receiver.setup(PORT);
	ofSetVerticalSync(true);
	ofSetFrameRate(60);
    ofEnableAlphaBlending();
//	CGDisplayHideCursor(kCGDirectMainDisplay);
    
    // set mode
    number = 0;
    
    // FBO
    rgbaFbo.allocate(ofGetScreenWidth(), ofGetScreenHeight(), GL_RGBA);
    rgbaFboFloat.allocate(ofGetScreenWidth(), ofGetScreenHeight(), GL_RGBA32F_ARB);
    rgbaFbo.begin();
	ofClear(255,255,255, 0);
    rgbaFbo.end();
    rgbaFboFloat.begin();
	ofClear(255,255,255, 0);
    rgbaFboFloat.end();
    fadeAmnt=10;

  // THE BACKGROUND FLOWS ----------------------------
    
    for (int i = 0; i < 450; i++){
		particle * myParticle = new particle;
        myParticle->setInitialCondition(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight()),0,0);
		bgParti.push_back(myParticle);
	}
	
 // THE FOREGROUND INDIVIDUALS FOR DRAWING----------------------------   
    
    for (int i = 0; i < 50; i++){
		myParticle.setInitialCondition(ofRandom(0,ofGetWidth()),ofRandom(0,ofGetHeight()),0,0);
        dwgParti.push_back(myParticle);
		
	}
   	
    //local interactions
	bRepel		= true;
	radius		= 40;
	strength	= 0.9f;
    
    //sound
	int bufferSize = 256;
	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;
    
	soundStream.setup(this, 0, 2, 44100, bufferSize, 4);
}
Exemplo n.º 6
0
CPlane::CPlane() {
    x = int(ofRandom(0 + (0.15*ofGetScreenWidth()), ofGetScreenWidth()-(0.15*ofGetScreenWidth())));
    y = int(ofRandom(0 + (0.1*ofGetScreenHeight()), ofGetScreenHeight()- (0.1*ofGetScreenHeight())));
    //printf("Widht: %i\n", ofGetScreenWidth());
    //printf("Height: %i\n", ofGetScreenHeight());
    //printf("PLANE: x:%f, y:%f\n", x, y);
    color = 0xfafa00;

    //ofAddListener(ofEvents.mousePressed, this, &CPlane::clicked);
}
Exemplo n.º 7
0
void GUIApp::setup()
{
    ofSetWindowTitle(STR_WINDOW_TITLE);
    ofSetVerticalSync(false);

    ofBackground(68, 84, 71);

    XBSettingsManager::getInstance().loadFile(STR_APPSETTINGS_FILENAME);
    float windowScale = XBSettingsManager::getInstance().getWindowScale();

    int winX, winY;
    if (MAIN_WINDOW_MODE == OF_WINDOW)
    {
        int windowWidths = int(MAIN_WINDOW_WIDTH * windowScale) + GUI_WINDOW_WIDTH;
        winX = ofGetScreenWidth()/2 - windowWidths/2 + int(MAIN_WINDOW_WIDTH * windowScale);
        winY = ofGetScreenHeight()/2 - int(MAIN_WINDOW_HEIGHT * windowScale)/2;
    }
    else
    {
        winX = ofGetScreenWidth()/2 - GUI_WINDOW_WIDTH/2;
        winY = ofGetScreenHeight()/2 - GUI_WINDOW_HEIGHT/2;
    }

    ofSetWindowShape(GUI_WINDOW_WIDTH, GUI_WINDOW_HEIGHT);
    ofSetWindowPosition(winX, winY);

    currentGuiIndex = -1;

    XBScene1GUI *s1GUI = new XBScene1GUI();
    s1GUI->setup();
    guis.push_back(s1GUI);
    XBScene2GUI *s2GUI = new XBScene2GUI();
    s2GUI->setup();
    guis.push_back(s2GUI);
    XBScene3GUI *s3GUI = new XBScene3GUI();
    s3GUI->setup();
    guis.push_back(s3GUI);
    XBScene4GUI *s4GUI = new XBScene4GUI();
    s4GUI->setup();
    guis.push_back(s4GUI);
    XBScene5GUI *s5GUI = new XBScene5GUI();
    s5GUI->setup();
    guis.push_back(s5GUI);
    XBScene6GUI *s6GUI = new XBScene6GUI();
    s6GUI->setup();
    guis.push_back(s6GUI);

    ofAddListener(sceneManager->eventSceneChanged, this, &GUIApp::sceneChanged);

    addLegendMessage("KEYS:");
    addLegendMessage("- [LEFT] Go to Previous Scene");
    addLegendMessage("- [RIGHT] Go to Next Scene");
    addLegendMessage("- [T] Show facade template");
    addLegendMessage("- [F] Show facade bitmap");
}
Exemplo n.º 8
0
void Prototype01::selfSetup(){
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    
    colorEdgesShader.loadFrag(getDataPath()+"shaders/colorEdges.frag");
    colorExtractionShader.loadFrag(getDataPath()+"shaders/colorExtraction.frag");
    complementColorShader.loadFrag(getDataPath()+"shaders/complementColor.frag");
    
    medianFilter.allocate(ofGetScreenWidth(), ofGetScreenHeight());
    colorExtractedFbo.allocate(ofGetScreenWidth(), ofGetScreenHeight());
    complementColorFbo.allocate(ofGetScreenWidth(), ofGetScreenHeight());
    bApplyMedian = false;
}
Exemplo n.º 9
0
//--------------------------------------------------------------
mainApp::mainApp(int argc, char * argv[]):
  previousEmotionReset(ofGetElapsedTimef()){
  // Set up the arguments
  po::options_description desc;
  layout_add_options(desc);
  twitter_add_options(desc);
  eeg_add_options(desc);
  expression_add_options(desc);
  desc.add_options()
    ("data", po::value<std::string>(),
     "the ABSOLUTE path to the data directory")
    ("debug",
     "use the first emotion and first 10 frames only, for debugging");

  // Parse the arguments
  po::variables_map vm;
  po::store(po::parse_command_line(argc, argv, desc), vm);
  po::notify(vm);

  // Make sure we have the data path
  if(vm.count("data") && (vm["data"].as<std::string>()[0] == '/')){
    this->data_path = vm["data"].as<std::string>();
  }else{
    throw runtime_error("Please specify --data /absolute/path/to/data/dir");
  }

  debugging = vm.count("debug");

  layout_initialize(vm, ofGetScreenWidth(), ofGetScreenHeight());
  twitter_initialize(vm);
  eeg_initialize(vm);
  expression_initialize(vm);
}
Exemplo n.º 10
0
	void setup(){
		w=ofGetScreenWidth();
		h=ofGetScreenHeight();
		touch.init("/dev/input/event0",w,h);
		ofLog()<<touch.getName();
		fbo.allocate(w,h);
	}
Exemplo n.º 11
0
//----------
void ofxSplashScreen::begin(float minimumDuration) {
	if (!this->image.isAllocated()) {
		ofLogError("ofxSplashScreen") << "Cannot show splash screen since no image has been loaded";
		return;
	}
	this->endTime = ofGetElapsedTimef() + minimumDuration;
	this->appWindow = glfwGetCurrentContext();
	
	glfwHideWindow(this->appWindow);
	glfwWindowHint(GLFW_DECORATED, GL_FALSE);
	this->splashScreenWindow = glfwCreateWindow(this->image.getWidth(), this->image.getHeight(), "ofxSplashScreen", NULL, this->appWindow);
	glfwSetWindowPos(this->splashScreenWindow, (ofGetScreenWidth() - this->image.getWidth()) / 2.0f, (ofGetScreenHeight() - this->image.getHeight()) / 2.0f);
	glfwWindowHint(GLFW_DECORATED, GL_TRUE);
	glfwMakeContextCurrent(this->splashScreenWindow);
	
	//set the drawing matrices to normalised coordinates
	ofSetMatrixMode(OF_MATRIX_PROJECTION);
	ofLoadIdentityMatrix();
	ofSetMatrixMode(OF_MATRIX_MODELVIEW);
	ofLoadIdentityMatrix();
	
	//draw the images
	ofClear(0,0,0);
	this->image.update();
	this->image.draw(-1,-1,2,2);
	glfwSwapBuffers(this->splashScreenWindow);
	glFlush();
	
	//set the context back to main for rest of setup
	glfwMakeContextCurrent(this->appWindow);
	ofSetupScreen();
}
Exemplo n.º 12
0
//--------------------------------------------------------------
void testApp::keyPressed(int key)
{
    if(key == 'f') // toggle fullscreen
    {
        bFullscreen = !bFullscreen;

        if(!bFullscreen)
        {
            ofSetWindowShape(1024,640);
            ofSetFullscreen(false);
            // figure out how to put the window in the center:
            int screenW = ofGetScreenWidth();
            int screenH = ofGetScreenHeight();
            ofSetWindowPosition(screenW/2-1024/2, screenH/2-640/2);
        }
        else if(bFullscreen == 1)
        {
            ofSetFullscreen(true);
        }
    }

    if(key == 's') // save image
        ofSaveFrame();

    if(key == 'c') // clear screen
    {
        ofBackground(0, 0, 0);
        ofBackground(0, 0, 0); // no mistake, one call might not _always_ clear the screen. (maybe due to double-buffering?)
    }

}
Exemplo n.º 13
0
//--------------------------------------------------------------
void ofApp::setup(){

    projector.setup("projector", ofGetScreenWidth(), 0, 1280, 800, true);
//    kinect.setup("/Users/gene/Downloads/hometest_single.oni");
    kinect.setup();
    kinect.enableCalibration(projector);
    kinect.loadCalibration("/Users/gene/Code/openFrameworks/tools_old/OpenNi/template-mask-calibrated/bin/data/calibration.xml");
    //kinect.loadCalibration("/Users/gene/Desktop/calibration.xml");
    
    ribbons.setup(projector.getWidth(), projector.getHeight());
    fluids.setup(projector.getWidth(), projector.getHeight());
    stars.setup(projector.getWidth(), projector.getHeight());
    backgrounding.setup(projector.getWidth(), projector.getHeight());
    skeleton.setup(projector.getWidth(), projector.getHeight());
    skeletonRivers.setup(projector.getWidth(), projector.getHeight());
    
    ribbons.getPanel().setPosition(0, 400);
    fluids.getPanel().setPosition(200, 400);
    stars.getPanel().setPosition(400, 400);
    backgrounding.getPanel().setPosition(600, 400);
    skeleton.getPanel().setPosition(800, 400);
    skeletonRivers.getPanel().setPosition(1000, 400);
    
    mode = 5;
}
Exemplo n.º 14
0
void ofCircles::update()	{
	angle = ofRandom(0, 2*PI);
	cx1 = ofGetScreenWidth()/2 + radius*cos(angle);
	cy1 = ofGetScreenHeight()/2 + radius*sin(angle);

	draw();
}
Exemplo n.º 15
0
void SceneGalaxy::setup(){
    instance = this;
    for(int i=0;i<4;i++){
        char fname[64];
        sprintf(fname,"galaxy%i.mp3",i);
        snd[i].loadSound(testApp::instance->dataPath+fname);
        snd[i].setMultiPlay(true);
    }
    
	int lowW = ofGetScreenWidth() / RESOLUTION_RATIO;
	int lowH = ofGetScreenHeight() / RESOLUTION_RATIO;
	
    Star::screenLowWidth = lowW;
    Star::screenLowHeight = lowH;
    
	loresScreen.allocate(lowW, lowH + 1, OF_IMAGE_COLOR);
	pixels = loresScreen.getPixels();
    
	blankLoresScreen();
	
	//for(int i=0;i<100;i++){
	//	points.push_back(ofVec2f( (lowW / 100.0 ) * i , lowH / 2 ));
	//}
	mouseIsDown = false;

	

}
Exemplo n.º 16
0
        void setup(){
            ofSetVerticalSync(false);

            w=ofGetScreenWidth();
            h=ofGetScreenHeight();

            ofDisableArbTex();
            img.load("1.jpg");
            player.load("1.mp4");
            player.play();
            player.setLoopState(OF_LOOP_NORMAL);
            gray = img;
            gray.setImageType(OF_IMAGE_GRAYSCALE);
            wc.load("wcolor.vert","wcolor.frag");

            ofFbo::Settings s;
            s.depthStencilAsTexture=true;
            s.useDepth=true;
            s.width=w;
            s.height=h;
            fboDepth.allocate(s);
            fbo.allocate(w,h);
            fbo.begin();
            ofClear(0,0,100,255);
            fbo.end();

            gui.setup();
            gui.add(stepGradient.set("step gradient",    .0015, -1., 1.));
            gui.add(advectStep.set("step advect",        .0015, -.1, .1));
            gui.add(flipHeightMap.set("flip height map",  0.7,   0.,  2.));
            gui.add(time.set("time",  0.,   0.,  1.));
            gui.add(advectMatrix.set("advect matrix",  ofVec4f(0.1),   ofVec4f(-1.),  ofVec4f(1.)));
            gui.add(switchVideo.set("switch video", false));
        }
void ofxManagedAudioUnit::showUI(string chainName, int chainIndex, int numChains, int unitIndex, int numUnits) {
    x = ofMap(chainIndex, 0, numChains - 1, 0, ofGetScreenWidth() * 0.5);
    y = ofMap(unitIndex, 0, numUnits - 1, 0, ofGetScreenHeight() * 0.5);
    unit.showUI(chainName + ": " +
                unitName + (unitName.length() > 0 ? " " : "") +
                className, x, y);
}
Exemplo n.º 18
0
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){

ofImage screenshot;
    screenshot.allocate(ofGetScreenWidth(), ofGetScreenHeight(), OF_IMAGE_COLOR);
    screenshot.grabScreen(0,0,1024,768);
    screenshot.saveImage("screenshot.png");
}
Exemplo n.º 19
0
//--------------------------------------------------------------
void testApp::draw() {
  ofImage im;
  
  timer = ofGetElapsedTimef();
  im = images[nimg];
  im.rotate90(rota);  
  im.draw((ofGetScreenWidth()-im.width)/2,(ofGetScreenHeight()-im.height)/2);
  if ((timer-image_timer)>image_duration) {
    nimg++; if (nimg==Nimgs) nimg=0;
    image_timer = timer;
	rota+=0.1;
  }
  
  if (sounds[nsnd].getIsPlaying()==false) {
    if (silence_trigger==false) { 
      // sound just ended 
      silence_trigger = true; 
      silence_timer = timer;
      silence_duration = ofRandom(10,120);
      cout << silence_duration << endl;
    }
    else {
      if ((timer-silence_timer)>silence_duration) {
	nsnd++; if (nsnd==Nsnds) nsnd=0;
	sounds[nsnd].play();
	silence_trigger = false;
      }
    }
  }
}
//! Initialisation des coordonnées des points de calibration à afficher
void CalibrationUtils::initScreenPoints()
{
    int i,j;
    //Angle entre deux axes (en radian)
    float delta_degree = 2*PI/(GRID_X+1);
    //Distance entre deux cercles
    float delta_rayon = min(screenBB.lowerRightCorner.X-screenBB.upperLeftCorner.X,screenBB.lowerRightCorner.Y-screenBB.upperLeftCorner.Y)/2/(GRID_Y+1);
    //Point au centre du cercle
    vector2df center = screenBB.upperLeftCorner + screenBB.lowerRightCorner/2;
	//Degre et rayon du point à afficher
    float degree=0, rayon=delta_rayon;
    int nb_points = GRID_X;
    float dist = (2*PI*delta_rayon)/GRID_X;
    float conv = ((float)ofGetScreenWidth())/ofGetScreenHeight();

    screenPoints->clear();
	screenPoints->push_back(calibrationPoint(center,0));
	for(j=1; j <= GRID_Y+1; j++) //Pour chaque cercle
    {
        delta_degree = 2*PI/nb_points;
        if (j%2 == 0) degree = 0;
        else degree = delta_degree/2;
        for(i=0; i < nb_points; i++) //Pour chaque points sur le cercle
        {
			screenPoints->push_back(calibrationPoint(center + vector2df(rayon*cos(degree)/conv,rayon*sin(degree)), j)); //Note : /1.25
			degree += delta_degree;
        }
        rayon += delta_rayon;
        nb_points += GRID_X; //(int)((2*PI*rayon)/dist)+1;
	}
}
//! Initialisation des points à lire
void CalibrationUtils::initCameraPoints(int camWidth, int camHeight)
{
	int i,j, p = 0;
    //Angle entre deux axes (en radian)
    float delta_degree = 2*PI/(GRID_X+1);
    //Distance entre deux cercles
    float delta_rayon = min(screenBB.lowerRightCorner.X-screenBB.upperLeftCorner.X,screenBB.lowerRightCorner.Y-screenBB.upperLeftCorner.Y)/2/(GRID_Y+1);
    //Point au centre du cercle
    vector2df center = screenBB.upperLeftCorner + screenBB.lowerRightCorner/2;
	//Degre et rayon du point à afficher
    float degree=0, rayon=delta_rayon;
    int nb_points = GRID_X;
    float dist = (2*PI*delta_rayon)/GRID_X;
    float conv = ((float)ofGetScreenWidth())/ofGetScreenHeight();

	cameraPoints[p] = calibrationPoint(center,0);
	p++;
	for(j=0; j<=GRID_Y; j++) //Pour chaque cercle
    {
        delta_degree = 2*PI/nb_points;
        if (j%2 == 0) degree = 0;
        else degree = delta_degree/2;
        for(i=0; i < nb_points; i++) //Pour chaque points sur le cercle
        {
			cameraPoints[p] = calibrationPoint(center + vector2df(rayon*cos(degree)/conv,rayon*sin(degree)), j+1); //Note : /1.25
			p++;
			degree += delta_degree;
        }
        rayon += GRID_X;
	}
}
Exemplo n.º 22
0
void ofApp::setup()
{
    ofSetWindowShape(1920, 1080);
    ofSetWindowPosition(ofGetScreenWidth()/2 - ofGetWidth()/2, 0);

    width = 540;
    theme = new ofxDatGuiThemeMidnight();

// create a button to attach items to the scroll view //
    addItem = new ofxDatGuiButton("click to add item");
    addItem->setStripeVisible(false);
    addItem->setWidth(width);
    addItem->setPosition(ofGetWidth()/2 - addItem->getWidth()/2, 240);
    addItem->setLabelAlignment(ofxDatGuiAlignment::CENTER);
    addItem->onButtonEvent(this, &ofApp::onAddNewItemButtonClick);
    
// create a scroll view that displays eight items at a time //
    view = new ofxDatGuiScrollView("ScrollView #1", 8);
    view->setWidth(width);
    view->setPosition(addItem->getX(), addItem->getY() + addItem->getHeight() + 1);
    view->onScrollViewEvent(this, &ofApp::onScrollViewEvent);
    
// add a button to allow us to clear the scroll view out //
    clearAll = new ofxDatGuiButton("click to clear all items");
    clearAll->setStripeVisible(false);
    clearAll->setWidth(width);
    clearAll->setPosition(ofGetWidth()/2 - clearAll->getWidth()/2, view->getY() + view->getHeight() + 1);
    clearAll->setLabelAlignment(ofxDatGuiAlignment::CENTER);
    clearAll->onButtonEvent(this, &ofApp::onClearAllButtonClick);
    
// add a few items for testing //
    for(int i=0; i<12; i++) view->add("item " + ofToString(view->getNumItems() + 1));
    addItem->setLabel("click to add item - " + ofToString(view->getNumItems()) + " items");
}
//--------------------------------------------------------------
void testApp::setup(){
	ofSetVerticalSync(true);
	//img.loadImage("indispensable.jpg");
	//ofSetLineWidth(2);
    
    camWidth = ofGetScreenWidth();
    camHeight = ofGetScreenHeight();
    
    //we can now get back a list of devices.
	vector<ofVideoDevice> devices = vidGrabber.listDevices();
	
    for(int i = 0; i < devices.size(); i++){
		cout << devices[i].id << ": " << devices[i].deviceName;
        if( devices[i].bAvailable ){
            cout << endl;
        }else{
            cout << " - unavailable " << endl;
        }
	}
    
    vidGrabber.setDeviceID(0);
	vidGrabber.setDesiredFrameRate(20);
	vidGrabber.initGrabber(camWidth,camHeight);
	
	ofSetVerticalSync(true);
    
}
Exemplo n.º 24
0
//--------------------------------------------------------------
void testApp::draw(){
    ofPushMatrix();
    if (pos.x>ofGetWidth()*2){
        ofTranslate(ofGetScreenWidth(),0);
    }
    ofPopMatrix();
}
Exemplo n.º 25
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetWindowShape(5, 5);
    vector<vector<float> > vals(4, vector<float>(4, 0.25));
    ofxMC::Matrix mat(vals);
    mc.setup(mat, 0);
    mouse.set(ofGetScreenWidth()/2, ofGetScreenHeight()/2);
}
Exemplo n.º 26
0
//--------------------------------------------------------------
void Tunnel::setup(){
    if(initialized) {
		return;
	}
    
	initialized = true;
    //hallModel.loadModel("Hallway1C.obj");
    hallModel.loadModel("hallway1.obj");
    hallModel.setPosition(0, 0, 0);
    
    camera.setup();
    camTargSet = false;
    camera.speed =  1.0f;
    //camera.speed =  1.0f;
    camera.sensitivityX = 0.05f;
    camera.sensitivityY = 0.05f;
    camera.accel = 0.02f;
    camera.disableMove();
    camera.disableStrafe();
    
    camPos = ofVec3f(0,0,0);
    
    distFactor = ((float)ofGetScreenWidth())/2560.0;
    
    goal1 = ofVec3f(442,0,854) * distFactor;
    goal2 = ofVec3f(-317,0,1175) * distFactor;
    
    hallModel.update();
    hallMesh = hallModel.getCurrentAnimatedMesh(0);
    
    secondTime = false;
    isPaused = false;
    hallWidth = 10.0 * distFactor;
    isClipping = true;
}
Exemplo n.º 27
0
//--------------------------------------------------------------
void testApp::setup(){	 
	
	
	int screenW = ofGetScreenWidth();
	int screenH = ofGetScreenHeight();
	ofSetWindowPosition(screenW/2-300/2, screenH/2-300/2);
	
	//load our typeface
	vagRounded.loadFont("vag.ttf", 16);

	bFullscreen	= 0;
	
	//lets set the initial window pos
	//and background color
	//ofSetVerticalSync(true);
	ofSetFrameRate(60);
	
	ofBackground(50,50,50);	
	
	
	ballPositionX = 150;
	ballPositionY = 150;
	ballVelocityX = ofRandom(-5,5);
	ballVelocityY = ofRandom(-5,5);
}
void kinactorApp::setupGUIleft()
{
    // INIT A GUI OBJECT: ofxUICanvas(float x, float y, float width, float height)		
    guileft = new ofxUICanvas(0,0,guiPanelLength+xInit,ofGetHeight()-(loggerH+xInit));
    guileft->setDrawWidgetPadding(true);
    guileft->addWidgetDown(new ofxUILabel("CONTROLS", OFX_UI_FONT_LARGE));
    guileft->addWidgetDown(new ofxUILabel("Press [h] to hide. [f] for fullscreen", OFX_UI_FONT_LARGE));
    guileft->addWidgetDown(new ofxUILabel("kinactor VIEWS: [1] - kinactor, [2] - debug, [3] - pointCloud", OFX_UI_FONT_SMALL));
    guileft->addWidgetDown(new ofxUISpacer(guiPanelLength-xInit, 2));
    guileft->addWidgetDown(new ofxUILabel("KINECT:", OFX_UI_FONT_MEDIUM)); 
    guileft->addWidgetDown(new ofxUILabelButton(false, "TILT UP [>]", OFX_UI_FONT_SMALL)); 
    guileft->addWidgetDown(new ofxUILabelButton(false, "TILT DOWN [<]", OFX_UI_FONT_SMALL)); 
    guileft->addWidgetDown(new ofxUILabelButton(false, "CONNECT [o]", OFX_UI_FONT_SMALL));
    guileft->addWidgetDown(new ofxUILabelButton(false, "DISCONNECT [c]", OFX_UI_FONT_SMALL));
    guileft->addWidgetDown(new ofxUIToggle( dim, dim, false, "DEPTH NEAR VALUE WHITE", OFX_UI_FONT_SMALL));
    guileft->addWidgetDown(new ofxUISpacer(guiPanelLength-xInit, 2));
    guileft->addWidgetDown(new ofxUILabel("PLAYBACK/RECORD", OFX_UI_FONT_MEDIUM));
    guileft->addWidgetDown(new ofxUISpacer(guiPanelLength-xInit, 2));
    guileft->addWidgetDown(new ofxUILabel("WINDOW OPTIONS:", OFX_UI_FONT_MEDIUM));
    
    // trPad for the interface, convert mtrx as RATIO and then to the PAD sizes
    int padHeight = (guiPanelLength - xInit) / 3;
    trPad = ofPoint((mtrx/ofGetScreenWidth())*(guiPanelLength-xInit),(mtry/ofGetScreenHeight())*padHeight);
    guileft->addWidgetDown(new ofxUI2DPad(guiPanelLength-xInit, padHeight, trPad, "TRANSLATE"));
    guileft->addWidgetDown(new ofxUISlider(guiPanelLength-xInit,dim, 0.0, 10.0, scaleFactor, "SCALE")); 
    ofAddListener(guileft->newGUIEvent, this, &kinactorApp::guiEvent);
    guileft->loadSettings("GUI/guileftSettings.xml");
}
Exemplo n.º 29
0
void SingleBrush::selfSetup(){
    ofSetCircleResolution(36);
    ofEnableAlphaBlending();
    ofDisableSmoothing();

    ofSetFullscreen(true);
    
    video.initGrabber(640, 480);
    
    colorAddShader.loadFrag(getDataPath()+"shaders/colorAdd.frag");
    noiseShader.loadFrag(getDataPath()+"shaders/noise.frag");
    absorveShader.loadFrag(getDataPath()+"shaders/absorve.frag");
    displaceShader.loadFrag(getDataPath()+"shaders/displace.frag");
    edge.loadFrag(getDataPath()+"shaders/edge.frag");
    
    ofDisableArbTex();
    ofLoadImage(brushTexture, getDataPath()+"brush.png");
    ofEnableArbTex();
    
    int width = ofGetScreenWidth();
    int height = ofGetScreenHeight();
    colorAdded.allocate(width,height);
    water.allocate(width, height,GL_RGB);
    flow.allocate(width, height);
    noise.allocate(width,height);
    canvas.allocate(width, height);
    edgeFbo.allocate(640, 480);
    
    bColorSample = true;
    
    color.set(0);
}
Exemplo n.º 30
0
ButtonGraphic::ButtonGraphic(ofImage* _upState, ofImage* _downState,
							 float _x, float _y, float _iScreen,
							 int _iAction) :
Button(_x, _y, 100, 100, "")
{
	upState = _upState;
	downState = _downState;
	
	xoffset = ofGetScreenWidth()*_iScreen;
	
	//load width/height from images
    //if we don't have an up image, then
    //use the downimage
    //else just let Button(..) deal with it
	if (upState !=0)
	{
		bounds.width = upState->width;
		bounds.height = upState->height;
		
	} else if (downState != 0) {
		
		bounds.width = downState->width;
		bounds.height = downState->height;
	
	}
	
	iAction = _iAction;
}