Пример #1
0
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    if( key == 'g' ){
        bHide = !bHide;
    }
    
    if (key=='m') {
        minimised=!minimised;
        if (minimised) {
            ofSetWindowShape(300, 30);
        }
        if (!minimised) {
            if (cameras.size()*camHeight<gui.getShape().height+80) {
                ofSetWindowShape(gui.getWidth()+80+camWidth * cameras.size(), gui.getShape().height+80);
            }
            if (cameras.size()*camHeight>gui.getShape().height+80) {
                ofSetWindowShape(gui.getWidth()+80+camWidth * cameras.size(), cameras.size()*camHeight);
            }
        }
    }
    
    if (key=='s') {
        gui.saveToFile("settings.xml");
    }
    
    if (key=='r') {
        gui.loadFromFile("settings.xml");
    }
    
}
Пример #2
0
/* Snippet begin */
void ofApp::setup(){
    ofSetWindowShape(500, 500);
    gif.setup(50);
    gif.fadeInOut(2, 1, ofColor::red);
    gif.enableTextOverlay();

    layerIncrement = 0.01;
    maskIncrement = 0.0005;

    numLayers = 20;
    numMasksPerLayer = 1;
    masker.setup(numLayers);

    layer.setup("rust-tall2.png");
    for(int i = 0; i < numLayers; i++) {
        scale = ofMap(i, 0, numLayers-1, 0.25, 1);
        layer.setTextureScale(scale);
        layer.setTextureOffset(i % 2 == 0 ? TEXTURE_OFFSET_TOP_LEFT : TEXTURE_OFFSET_TOP_RIGHT);
        layer.setTextureOffsetY(ofRandom(2));
        layers.push_back(layer);

        maskLoader.clear();
        scale = ofMap(i, 0, numLayers-1, 0.5, 1.3);
        mask.setup("circle-feather.png", scale, TEXTURE_OFFSET_MIDDLE_CENTER);
        for(int j = 0; j < numMasksPerLayer; j++) {
            mask.setTextureOffsetY(ofRandom(2));
            maskLoader.push_back(mask);
        }
        masks.push_back(maskLoader);
    }

    ofSetWindowShape(1000, 1200);
    masker.toggleOverlay();
}
Пример #3
0
/* Snippet begin */
void ofApp::setup(){
    ofSetWindowShape(500, 500);
    gif.setup(40);
    gif.fadeInOut(1, 2, ofColor::white);
    gif.enableTextOverlay();
    numRoads = 2;
    masker.setup(numRoads + 1);
    rectWidth = gif.width / 3;
    halfRectWidth = rectWidth * 0.5;
    
    road.setup("road.png", 1.0, TEXTURE_OFFSET__MIDDLE__RIGHT_TO_CENTER);
    for(int i = 0; i < numRoads; i++) {
        scale = ofMap(i, 0, numRoads-1, 5, 1.3);
        road.setTextureScale(scale);
        road.setTextureOffsetY(ofRandom(2));
        road1s.push_back(road);
    }
    
    road.setup("road.png", 1.0, TEXTURE_OFFSET__MIDDLE__RIGHT_TO_CENTER);
    for(int i = 0; i < numRoads; i++) {
        scale = ofMap(i, 0, numRoads-1, 0.7, 2);
        road.setTextureScale(scale);
        road.setTextureOffsetY(ofRandom(2));
        road2s.push_back(road);
    }
    
    ofSetWindowShape(1200, 1200);
    masker.toggleOverlay();
}
Пример #4
0
/* Snippet begin */
void ofApp::setup(){
    ofSetWindowShape(500, 500);
    gif.setup(50);
    gif.fadeInOut(2, 3, ofColor::darkGray);
    gif.enableTextOverlay();
    numLayers = 8;
    masker.setup(numLayers + 1);
    rectSize = 200;
    rectThickness = 2;
    speed = 0.1;
    
    img.setup("pcb2.png", 1.0, TEXTURE_OFFSET__MIDDLE__LEFT_TO_CENTER);
    for(int i = 0; i < numLayers; i++) {
        scale = ofMap(i, 0, numLayers-1, 0.25, 0.7);
        img.setTextureScale(scale);
        img.setTextureOffsetY(ofRandom(2));
        textures.push_back(img);
    }
    
    img.setup("road.png", 1.0, TEXTURE_OFFSET__MIDDLE__RIGHT_TO_CENTER);
    for(int i = 0; i < numLayers; i++) {
        scale = ofMap(i, 0, numLayers-1, 1.4, 0.75);
        img.setTextureScale(scale);
        img.setTextureOffsetY(ofRandom(2));
        masks.push_back(img);
    }

    ofSetWindowShape(1200, 1200);
    masker.toggleOverlay();
}
Пример #5
0
void HandJesture::keyPressed (int key)
{
	ofLog(OF_LOG_VERBOSE, ofToString(key));
	switch (key)
	{
		case '>':
		case '.':
			farThreshold ++;
			if (farThreshold > 255) farThreshold = 255;
			break;
		case '<':		
		case ',':		
			farThreshold --;
			if (farThreshold < 0) farThreshold = 0;
			break;
			
		case '+':
		case '=':
			nearThreshold ++;
			if (nearThreshold > 255) nearThreshold = 255;
			break;
		case '-':		
			nearThreshold --;
			if (nearThreshold < 0) nearThreshold = 0;
			break;
        case 'd':
            //解析結果の表示の on / off
            debug ? debug=false : debug=true;
            break;
		case 'r':
			// reboot kinect
			kinect.close();
			kinect.open();
			kinect.setCameraTiltAngle(angle);
            break;
		case ' ':
			showConfigUI = !showConfigUI;
			if (showConfigUI) {
				ofSetWindowShape(800, 600);
			} else {
				ofSetWindowShape(400, 300);
				kinect.setCameraTiltAngle(angle);
			}
			break;			
		case OF_KEY_UP:
			angle++;
			if(angle>30) angle=30;
			kinect.setCameraTiltAngle(angle);
			break;
			
		case OF_KEY_DOWN:
			angle--;
			if(angle<-30) angle=-30;
			kinect.setCameraTiltAngle(angle);
			break;
	}
}
Пример #6
0
//--------------------------------------------------------------
void testApp::setup(){

	//ofSetWindowPosition(0,0);
#ifdef OCULUS_RIFT
	ofSetWindowShape(1920*2,1080);
#else
	ofSetWindowShape(1920,1080);
#endif
	ofSetVerticalSync(true);
	shouldPlayTestVideo = false;
	ofSetLogLevel(OF_LOG_NOTICE);
    
	CloudsSpeaker::populateSpeakers();
	map<string,CloudsSpeaker>::iterator it;
	for(it = CloudsSpeaker::speakers.begin(); it != CloudsSpeaker::speakers.end(); it++){
		speakerKeys.push_back(it->first);
	}
	curSpeaker = 0;

	parser.loadFromFiles();
	hud.setup();
	
	////////////////////////////////////////////////
	//stringstream questions;
	//for(int i = 0; i < parser.getAllClips().size(); i++){
	//	CloudsClip* clip = parser.getAllClips()[i];
	//	if(clip->isLanguageCompatible() && clip->hasQuestion()){
	//		map<string,string>::iterator it;
	//		for( it = clip->getAllQuestionTopicPairs().begin(); it != clip->getAllQuestionTopicPairs().end(); it++){
	//			questions << clip->getLinkName() << "	" << it->first << "	" << it->second << "	" << (clip->hasSpecialKeyword("#oculus") || clip->hasSpecialKeyword("#start") ? "YES" : "NO") << endl;
	//		}
	//	}
	//}
	//ofBufferToFile(GetCloudsDataPath() + "TRANSLATED_question_topics.txt", ofBuffer(questions.str()));
	////////////////////////////////////////////////

	testVideoIndex = 0;

	rgbd.setup();
	rgbd.setDrawToScreen(false);
#ifdef OCULUS_RIFT
    // Link the HUD.
    rgbd.hud = &hud;
    rgbd.setupHUDGui();
#endif
	CloudsVisualSystem::getRGBDVideoPlayer().showingLowerThirds = true;

	//rgbd.forceScreenResolution(1920*2,1080*2);
	//rgbd.addTransionEditorsToGui();
	rgbd.playSystem();

	hud.setHudEnabled(true);

	type = CloudsVisualSystem::FLY_THROUGH;
}
Пример #7
0
/* Snippet begin */
void ofApp::setup(){
    ofSetWindowShape(500, 500);
    gif.setup(50);
    gif.fadeInOut(3, 6, ofColor::white);
    gif.enableTextOverlay();
    pattern1.setup(&gif);
    pattern2.setup(&gif);
    pattern3.setup(&gif);
    masker.setup(2);
    masker.toggleOverlay();
    ofSetWindowShape(1200, 1200);
}
Пример #8
0
void testApp::setScreenSize(string name)
{
    if (name == "1024x768") {
        ofSetWindowShape(1024, 768);
    } else if (name == "960x540") {
        ofSetWindowShape(960, 540);
    } else if (name == "1920x1080") {
        ofSetWindowShape(1920, 1080);
    } else if (name == "640x480") {
        ofSetWindowShape(640, 480);
    }
}
Пример #9
0
/* Snippet begin */
void ofApp::setup(){
    ofSetWindowShape(500, 500);
    gif.setup(60);
    gif.enableTextOverlay();
    pattern1.setup(&gif);
    masker.setup(1);
    masker.toggleOverlay();
    img1.setup("foil-large.png");
    img2.setup("face-full.png", 2000.0, TEXTURE_OFFSET__TOP__LEFT_TO_CENTER);
    img2.incrementTextureOffsetY(0.27);
    
    ofSetWindowShape(1200, 1200);
}
Пример #10
0
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h) {
    if (w < 600) {
        ofVec2f windowPosition = ofVec2f(ofGetWindowPositionX(), ofGetWindowPositionY());
        ofSetWindowShape(600, h);
        ofSetWindowPosition(windowPosition.x, windowPosition.y);
    }
    if (h < 400) {
        ofVec2f windowPosition = ofVec2f(ofGetWindowPositionX(), ofGetWindowPositionY());
        ofSetWindowShape(w, 400);
        ofSetWindowPosition(windowPosition.x, windowPosition.y);
    }

    //hsvGui.setPosition(ofPoint(w-200, 0));
}
Пример #11
0
//--------------------------------------------------------------
void ofApp::update()
{
    
    dir.x = ofRandomf() * 1.57;
    pos.x = (width / 2.0) + (ofRandomf() * 0.5);
    
    
    if(isDrawS && !isPaused)
        fluid.addTemporalForce(pos, dir, ofFloatColor(0.12, 0.09, 0.09), rad, temp, den);
    
    if(isPaused)
        pCount += ofGetFrameRate() / 60;
    if(pCount >= pTime)
    {
        pCount = 0;
        isPaused = false;
    }
    
    if(!isStatA)
        ofSetWindowShape(width, height);
    else
        ofSetWindowShape(width + 85.0, height);
    
    //  Update
    //
    fluid.update();
    
    ofSetWindowTitle(ofToString(ofGetFrameRate()));
    
    updateArduino();
    
    if(!isPaused)
    {
        
        irsVal = (float)ard.getAnalog(5);
    }
    
    
    if(irsVal < 590.0)
    {
        isPaused = true;
    }
    else
    {
        isPaused = false;
    }
    

}
Пример #12
0
/* Snippet begin */
void ofApp::setup(){
    ofSetWindowShape(500, 500);
    gif.setupPaused(40, 90);

    numLayers = 2;
    masker.setup(numLayers, ISOLATE_LAYERS);
    masker.toggleOverlay();
    
    img1.setup("pcb-bw.png");
    img2.setup("rust-tall2.png", 1.0, TEXTURE_OFFSET__MIDDLE__RIGHT_TO_CENTER);
    
    horizontalMasks.setup(200, gif.height);
    
    ofSetWindowShape(1200, 1200);
}
Пример #13
0
void testApp::setup(){
	
	ofSetFrameRate(30);

	// set our app mode
	appMode = APP_MODE_TRACKING;
	
	// load the movie (The Target by Jacob Dow)
	// available on vimeo: https://vimeo.com/35391502
	source.loadMovie("TheTarget.mov");
	
	// create a CV "map" to show the areas of matching color
	changedPixelsMap.allocate(source.getWidth(), source.getHeight());
	currentFrameCvRGB.allocate(source.getWidth(), source.getHeight());
	currentFrameCv.allocate(source.getWidth(), source.getHeight());
	previouFrameCv.allocate(source.getWidth(), source.getHeight());
	
	// create a window as big as the image
	ofSetWindowShape(source.getWidth()*2, source.getHeight());
	
	// how close should the color be to the picked color
	motionThreshold = 35;
	
	// current frame
	currentFrame = 0;
	
	// we haven't saved our data yet
	bDataExtracted = false;
	
	// create a canvas texture to accumulate paint shapes
	canvas.allocate(source.getWidth(), source.getHeight(), GL_RGB);
}
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetWindowShape(100, 100);
    ofBackground(204);

    da = Diagonals(0, 80, 1, 2, 0);
    db = Diagonals(0, 55, 2, 6, 255);
}
Пример #15
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetVerticalSync(true);
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    
    width = 1500;
    height = 400;
    
    ofSetWindowShape(width, height);
    
    //  SOUND
    //
	soundStream.setup(this, 0, 2, 44100, 256, 4);
    smoothedVol     = 0.0;
    micBar.setLabel("mic");
    
    time    = 0.0;
    zoom    = 1.0;
    angle   = 0.0;
    bDebug  = true;
    
    ofSeedRandom(0);
    
    glyph.create(100);
    terrain.createFromGlyph(glyph);
    terrain.resolution  = 2;
    terrain.topAltitud  = 300;
    
    cameraFocus.pos = glyph.getPathPositionAt(0.0);
    light.setPosition(ofVec3f(0,0,300));
//    light.rotate(54, ofVec3f(1,0,0.0));
//    light.setDiffuseColor(ofColor(255));
//    light.setAmbientColor(ofColor(50,21,33));
}
Пример #16
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);
}
Пример #17
0
//--------------------------------------------------------------
void testApp::setup(){
    sampleRate = 44100;
    channels = 2;

    ofSetFrameRate(60);
    ofSetLogLevel(OF_LOG_VERBOSE);
    vidGrabber.setDesiredFrameRate(30);
    vidGrabber.initGrabber(640, 480);
//    vidRecorder.setFfmpegLocation(ofFilePath::getAbsolutePath("ffmpeg")); // use this is you have ffmpeg installed in your data folder

    fileName = "testMovie";
    fileExt = ".mov"; // ffmpeg uses the extension to determine the container type. run 'ffmpeg -formats' to see supported formats

    // override the default codecs if you like
    // run 'ffmpeg -codecs' to find out what your implementation supports (or -formats on some older versions)
    vidRecorder.setVideoCodec("mpeg4"); 
    vidRecorder.setVideoBitrate("800k");
    vidRecorder.setAudioCodec("mp3");
    vidRecorder.setAudioBitrate("192k");

//    soundStream.listDevices();
//    soundStream.setDeviceID(11);
    soundStream.setup(this, 0, channels, sampleRate, 256, 4);

    ofSetWindowShape(vidGrabber.getWidth(), vidGrabber.getHeight()	);
    bRecording = false;
    ofEnableAlphaBlending();
}
Пример #18
0
//--------------------------------------------------------------
void ofApp::setup(){

    // set the size of the window
    ofSetWindowShape(window_w, window_h);

    size = window_w;
    position = (float *)malloc(sizeof(float)*size);
    velocity = (float *)malloc(sizeof(float)*size);
    sand_positions = (int *)malloc(sizeof(int)*size);

    for(int x = 0; x < size; x++)
    {
        position[x] = window_h/2;
        velocity[x] = 0.0;//10*ofRandomf();

        if(x < size/2)
        {
            sand_positions[x] = window_h/3;
        }
        else
        {
            sand_positions[x] = 0;
        }

    }

}
Пример #19
0
/* This handles the setup and GIF rendering, etc */
void ofApp::setup(){
    //Gif render values
    slowMode = false;
    width = 400, height = 400;
    duration = 0.2, colors = 256;
    saveOnFrame = -1;
    
    filename = ofGetTimestampString("%Y-%m-%d") + ".gif";
    framerate = slowMode ? 5 : 10;
    
    //Init
    ofSetFrameRate(framerate);
    ofSetWindowShape(width, height);
    gifEncoder.setup(width, height, duration, colors);
    renderingNow = false;
    renderMessage = "";
    
    fbo.allocate(width, height, GL_RGB);
    fbo.begin();
    ofClear(255, 255, 255, 0);
    fbo.end();
    
    //Begin patch
    setupAnim();
}
Пример #20
0
//--------------------------------------------------------------
void ofApp::setup()
{
	ofSetWindowShape(1280, 960);

	/*
	Currently init() takes two boolean parameters, i.e. init(true, true)
	The first parameter tells ofxRSSDK to stream color frames as well as depth frames (default: true)
	The second parameter tells ofxRSSDK to populate internal texture structures from the raw
	depth and color frames.  If this is false, the ofApp itself will need to define ofTextures and
	load the data manually (if ofTextures are desired) (default: true)
	*/
	if (!mRSSDK.init())
	{
		ofLogError("Unable to create ofxRSSDK object");

	}
	else
	{
		int cW = static_cast<int>(mRSSDK.getWidth());
		int cH = static_cast<int>(mRSSDK.getHeight());
		mDepthColorTex.allocate(cW, cH, GL_RGB);
		mDepthColorPixels = new uint8_t[cW*cH * 3];
		mNearColor = ofColor(255, 0, 0);
		mFarColor = ofColor(20, 40, 255);

		for (int i = 0; i < cW*cH*3; i++) {
			mDepthColorPixels[i] = 0;
		}
	}

}
Пример #21
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    sampleRate 	= 44100; /* Sampling Rate */
	bufferSize	= 512; /* Buffer Size. you have to fill this buffer with sound using the for loop in the audioOut method */
    fftSize = 1024;
    bufferDuration = 4.0f; // Duration in seconds

    frameWidth = 1024*2;
    frameHeight = 104*2;
    
    inputMode = INPUT_LIVE;
    
    doFind = false;

//    samplePlayer.load(ofToDataPath("03_Prelude_op67no1_mono.wav")); // ofToDataPath tells the load function to look in the data folder
    
	ofBackground(10,10,10);
    ofSetWindowShape(2400, 1600);
    
    ofSoundStreamSetup(2,2,this, sampleRate, bufferSize, 4); /* this has to happen at the end of setup - it switches on the DAC */
    
    ofxMaxiSettings::setup(sampleRate, 2, bufferSize);

    source.setup( sampleRate, bufferSize, fftSize );
    live.setup( bufferDuration, sampleRate, bufferSize, fftSize );

    finder.setup();
    keys.setup();
    
    tracks.setup( &keys );
    lights.setup( &keys );
    
//    temp();

}
Пример #22
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);
}
Пример #23
0
void ofApp::setup()
{
    ofxDatGuiLog::quiet();

// create a simple circle and position it in the middle of the screen //
    circle = new Circle(150);
    
// instantiate our gui and a couple of range sliders //
    gui = new ofxDatGui( ofxDatGuiAnchor::TOP_RIGHT );
    gui->addHeader("ofxDATGUI DATA BINDING EXAMPLE");
    sx = gui->addSlider("CIRCLE X", 0, ofGetWidth());
    sy = gui->addSlider("CIRCLE Y", 0, ofGetHeight());
    
// bind the circle's x & y properties to the gui sliders //
    sx->bind(circle->x);
    sy->bind(circle->y);

    ofSetWindowPosition(0, 0);
    ofSetWindowShape(1920, 1080);
    
// center the circle onscreen //
    circle->x = ofGetWidth() / 2;
    circle->y = ofGetHeight() / 2;
    
}
void MouseResponseColor::setup(){

    ofSetWindowShape(700,700);
    max_distance = ofDist(0, 0, 700, 700);
    ofEnableSmoothing();
    ofEnableAlphaBlending();
}
Пример #25
0
//--------------------------------------------------------------
void testApp::setup()
{
    ofSetWindowShape(800, 600);
    ofSetVerticalSync(true);
    glEnable(GL_DEPTH_TEST);
    scene = new testScene();
}
//--------------------------------------------------------------
bool ofxDetectDisplays::placeWindowOnDisplay(int displayID, bool borderless)
{

#if defined(TARGET_OSX)
    ofSetFullscreen(false);
    ofSetWindowPosition(displays[displayID]->left, displays[displayID]->top);
    ofSetWindowShape(displays[displayID]->width, displays[displayID]->height);

#elif defined(TARGET_WIN32)
	HWND hwnd = ofGetWin32Window();
 
	DWORD EX_STYLE;
	DWORD STYLE;

	if (borderless) {
		EX_STYLE = WS_EX_WINDOWEDGE;
		STYLE = WS_OVERLAPPED;
	}
	else {
		EX_STYLE = WS_EX_OVERLAPPEDWINDOW;
		STYLE = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
	}
	
	SetWindowLong(hwnd, GWL_EXSTYLE, EX_STYLE);
	SetWindowLong(hwnd, GWL_STYLE, STYLE);
	SetWindowPos(hwnd, HWND_TOPMOST, displays[displayID]->left, displays[displayID]->top, displays[displayID]->width, displays[displayID]->height, SWP_SHOWWINDOW);
#endif

	return true;
}
Пример #27
0
//--------------------------------------------------------------
void testApp::setup(){

	ofSetCircleResolution(50);
    
	ofSetWindowTitle("openframeworks gvf visualiser");
    ofSetWindowShape(1024, 768);
    
	ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps.
    
    ofPoint wSize = ofGetWindowSize();
    scrW = wSize.x;
    scrH = wSize.y;
    printf("w: %d h: %d\n", scrW, scrH);
    
    drawArea = ofRectangle(ofPoint(0, 0), ofGetWindowWidth(), ofGetWindowHeight());
    
    currentGesture.setDrawArea(drawArea);
    
    isMouseDrawing = false;
    
    viewYRotation = 0;
    viewXRotation = 0;
    
    initializeGui();
    initColors();

    //leap: open the controller
    	leap.open();
    
}
Пример #28
0
//--------------------------------------------------------------
void testApp::setup(){
    ofEnableAlphaBlending();
    
    
    //ofSetDataPathRoot("data/");
    
	context.setup();
	depth.setup(&context);
	user.setup(&context, true);
	context.toggleMirror();
    
	string host = "localhost";
	int	port	= 3333;
	
	ofxXmlSettings XML;
	
	if (XML.loadFile("config.xml")){
		host = XML.getValue("HOST", "localhost");
		port = XML.getValue("PORT", 3333);

		thresholdDistance = XML.getValue("THRESHOLD", 400);
        trackedUser = XML.getValue("TRACKEDUSER", 0);
	} else 
		cout << "config.xml file not found" << endl;
	
	hManager.setup(host.c_str() ,port);
	hManager.numberUsers(MAXUSER);
    
    logo.loadImage("logo.png");
    
	ofSetWindowShape(640, 480);
}
Пример #29
0
//--------------------------------------------------------------
void testApp::setup(){
    ofEnableAlphaBlending();
	ofSetWindowShape(640, 480);
    
    // Initial Allocation
    //
    fluid.allocate(640, 480, 0.5);
    
    // Seting the gravity set up & injecting the background image
    //
    fluid.setGravity(ofVec2f(0.0,-0.098));
    fluid.setDissipation(0.99);
    fluid.setVelocityDissipation(0.99);
    
    //  Set obstacle
    //
    fluid.begin();
    ofSetColor(255);
    ofCircle(640*0.5, 480*0.7, 10);
    ofCircle(640*0.5-30, 480*0.7-60, 5);
    ofCircle(640*0.5+30, 480*0.7-60, 5);
    ofCircle(640*0.5+50, 480*0.7-120, 2);
    ofCircle(640*0.5-50, 480*0.7-120, 2);
    fluid.end();
    
    // Adding constant forces
    //
    fluid.addConstantForce(ofPoint(640*0.5,480*0.85), ofPoint(0,-3.), ofFloatColor(0.5,0.1,0.0), 5.f);
    //fluid.addConstantForce(ofPoint(640*0.5,480*0.85), ofPoint(0,-1), ofFloatColor(0.0,0.3,0.0), 3.f);
    
}
Пример #30
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetFrameRate(60);
    ofEnableAlphaBlending();
    ofSetWindowShape(640, 480);
    
    water.loadBackground("fondo.jpg");
}