示例#1
0
//--------------------------------------------------------------
void ofApp::setup(){

    ofBackground(255);
    ofSetBackgroundAuto(false);
    ofEnableSmoothing();
    ofSetFrameRate(60);
    
    for(int i=0;i<20;i++){
        movers.push_back(Mover(ofRandom(0.1,2),ofRandom(ofGetWidth()),ofGetHeight()));
    }
   
}
示例#2
0
//--------------------------------------------------------------
void testApp::setup(){

	ofSetFrameRate(60);
	ofBackground(255, 255, 255);
	ofEnableSmoothing();
	
	radius =50;
	
	pos.x = click.x = 0;
	pos.y = click.y = ofGetHeight() / 2.0;
	
}
示例#3
0
void testApp::setup() {
	ofSetVerticalSync(true);
    ofEnableSmoothing();
	
	int n = ofxKinect::numAvailableDevices();    
	while(sensors.size() < n) {
		sensors.push_back(ofPtr<CircleSensor>(new CircleSensor()));
		sensors.back()->setup();
	}
    ofSort(sensors, bySerial);
    
    ofxXmlSettings xml;
    xml.loadFile("settings.xml");
	
	float dim = 20;
	float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; 
	float length = 320 - xInit;
	gui = new ofxUICanvas(0, 0, length + xInit * 2, 2560);
	gui->setFont("/System/Library/Fonts/Geneva.dfont");
	ofColor cb(64, 192),
	co(192, 192),
	coh(128, 192),
	cf(240, 255),
	cfh(128, 255),
	cp(96, 192),
	cpo(255, 192);
	gui->setUIColors(cb, co, coh, cf, cfh, cp, cpo);
	
    gui->addLabel("Kinects: " +  ofToString(ofxKinect::numConnectedDevices()) + " / " + ofToString(ofxKinect::numTotalDevices()), OFX_UI_FONT_SMALL);
    
	gui->addLabel("Background", OFX_UI_FONT_LARGE);
	gui->addLabelToggle("Debug", &showDebug, length, dim);
	gui->addLabelButton("Set dead zones", &setDeadZones, length, dim);
	gui->addLabelButton("Clear", &backgroundClear, length, dim);
	gui->addLabelToggle("Calibrate", &backgroundCalibrate, length, dim);
	gui->addSlider("Threshold", 0, 255, &backgroundThreshold, length, dim);
	
	gui->addLabel("Tracking", OFX_UI_FONT_LARGE);
	gui->addSlider("Blur radius", 0, 11, &blurRadius, length, dim);
	gui->addSlider("Threshold", 0, 255, &circleThreshold, length, dim);
	gui->addSlider("Min radius", 0, 12, &minRadius, length, dim);
	gui->addSlider("Max radius", 0, 12, &maxRadius, length, dim);
	gui->addSlider("Sample radius", 0, 24, &sampleRadius, length, dim);
	
	gui->addLabel("Registration", OFX_UI_FONT_LARGE);
	gui->addLabelButton("Clear", &registrationClear, length, dim);
	gui->addLabelToggle("Calibrate", &registrationCalibrate, length, dim);
	gui->addSlider("Calibration accuracy", 100, 10000, &registrationCalibrationAccuracy, length, dim);
    
    gui->addLabel("Filtering", OFX_UI_FONT_LARGE);
	gui->addSlider("Max velocity", 0, 10000, &maxVelocity, length, dim);  
	gui->addSlider("Filter rate", 0, 1, &filterRate, length, dim);
}
//--------------------------------------------------------------
void testApp::setup()
{
    ofSetVerticalSync(true); 
    ofEnableSmoothing(); 
    path = new ofxSuperPath();
    path->reset();

    marking = NULL;
    brush = NULL;
    paint = NULL;
    
}
//--------------------------------------------------------------
void testApp::setup(){
    maximumAreaThreshold = getMaximumTriangleArea()/5;  // we'll use this value for determining which layers to enable
    triangleReceiver.setup(3334);       // setup trianglereceiver to listen on port 3334
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    
    // img player
    shape1.loadSequence("image/shape_layer", "png", 1, 20, 2);
	shape1.preloadAllFrames();	
    
    playingImg = false; 
}
示例#6
0
//--------------------------------------------------------------
void testApp::setup(){
    xC = 0;
    yC = 0;
    ct = .0;
    ofBackground(0);
    ofSetColor(255,127,0);
    ofNoFill();
    ofEnableSmoothing();
    ofSetCircleResolution(128);
    pos.set(0, 0, 0);

}
void testApp::setup(){
    //画面の基本設定
    ofBackground(0,0,0);
    ofEnableSmoothing();
    //画面の混色の設定を加算合成にする
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    //キャプチャするムービーのサイズを指定
    camWidth = 480;
    camHeight = 320;
    vidGrabber.setVerbose(true);
    vidGrabber.initGrabber(camWidth,camHeight);
}
示例#8
0
Panel::Panel() {
    bounds = ofRectangle(0, 0, 1, 1);
    rotSpeed = 0.0f;
    lastSpeed = 0.0f;
    maxSpeed = 100.0f;
    rotAcc = 1.0f;
    rot = 0;
    bFlipping = false;
    bNeedsUpdate = false;
    
    ofEnableSmoothing();
}
示例#9
0
//------------------------------------------------------------------------------
void ofApp::setup()
{
    ofEnableAntiAliasing();
    ofEnableSmoothing();
    ofSetFrameRate(60);
    glEnable(GL_DEPTH_TEST);

    particleEmitter = new MeshParticleEmitter(10, 100.0f, 2.0f);

    light.setPointLight();
    light.setPosition(0,0,0);
}
示例#10
0
//--------------------------------------------------------------
void testApp::setup(){
    
    ofEnableSmoothing();
    
    myHue = 136.70;
    
    // Debug mode was used to draw out my points.
    // I played around with the points and the triangles for a while
    // just trying to find what shape I liked.
    // The shape I came up with was inspired by, but didn't use
    // Delaunay triangulation
    if (debug){
        for (int i = 0; i < 10; i++){
            points.push_back(ofPoint(0,0));
        }
        currentPoint = 0;
    } else {
        points.push_back(ofPoint(235, 149));
        points.push_back(ofPoint(366, 93));
        points.push_back(ofPoint(321, 211));
        points.push_back(ofPoint(412, 215));
        points.push_back(ofPoint(469, 167));
        points.push_back(ofPoint(483, 257));
        points.push_back(ofPoint(424, 360));
        points.push_back(ofPoint(286, 353));
        points.push_back(ofPoint(302, 279));
        points.push_back(ofPoint(206, 231));
    }
    
    triangles.push_back(ofVec3f(0, 1, 2));
    triangles.push_back(ofVec3f(1, 2, 3));
    triangles.push_back(ofVec3f(1, 3, 4));
    triangles.push_back(ofVec3f(3, 4, 5));
    triangles.push_back(ofVec3f(3, 5, 6));
    
    triangles.push_back(ofVec3f(6, 3, 2));
    triangles.push_back(ofVec3f(6, 8, 7));
    triangles.push_back(ofVec3f(7, 8, 9));
    triangles.push_back(ofVec3f(9, 8, 2));
    triangles.push_back(ofVec3f(0, 9, 2));


    
    
    
    
    
    generateColors();
    
    
    
}
示例#11
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetWindowShape(640,360);
    ofEnableSmoothing();
    ofEnableAlphaBlending();
    ofBackground(0);
    
    movers.resize(1020);
    
    for(unsigned int i = 0; i < movers.size(); i++){
        movers[i].setup();
    }
    ofSetVerticalSync(true);
}
示例#12
0
文件: testApp.cpp 项目: MrMdR/julapy
//--------------------------------------------------------------
void testApp::setup()
{
	ofBackground(255,255,255);
	ofSetVerticalSync( true );
	ofEnableSmoothing();
	
	ribbonType.loadTrueTypeFont( "ChartITCbyBTBla.ttf", 120 );
	ribbonRotation		= 0;
	ribbonRotationCount	= 0;
	wrapTypeOnRibbon	= false;
	
	ribbonType.wrapRibbonSurface( wrapTypeOnRibbon );
}
void SchQ_Particle_System :: draw(){
    quad_tree.draw();                                                                           // Draw the Qtree
    ofEnableSmoothing();
    for (vector<Spring>::iterator i = springs.begin(); i != springs.end(); i++) {               // Draw the springs
        Vec2D<double> p0 = i->a->get_position(), p1 = i->b->get_position();
        ofSetColor(0);
        ofSetLineWidth(2);
        ofLine(p0.x, p0.y, p1.x, p1.y);
    }
    for (vector<SchQ_Particle*>::iterator i = particles.begin(); i != particles.end(); i++)     // Draw the particles
        (*i)->draw();
    ofDisableSmoothing();
}
示例#14
0
//--------------------------------------------------------------
void testApp::setup(){
	ofSetFrameRate(60);
    ofBackground(0, 10, 10);
    ofEnableSmoothing();
	ofEnableAlphaBlending();
	ofSetCircleResolution(200);
	ofSetVerticalSync(true);
	
	circle = new Circle();
	
	header.loadFont("Andale Mono", 9, true, true);
	header.setLineHeight(15.0f);
}
示例#15
0
//--------------------------------------------------------------
void testApp::setup(){
    int i;
    ofBackground(0, 0, 0); //背景色の設定
    ofEnableAlphaBlending(); //透明度を使用可能に
    ofSetLineWidth(2); //線の太さの設定
    ofEnableSmoothing(); //線の描画をスムースに
    for(i=0; i<1000; i++){ //線の始点と終点の座標をランダムに決定
        start_x[i] = ofRandom(0, ofGetWidth());
        start_y[i] = ofRandom(0, ofGetHeight());
        end_x[i] = ofRandom(0, ofGetWidth());
        end_y[i] = ofRandom(0, ofGetHeight());
    }
}
示例#16
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofBackground(0, 0, 0);
    ofEnableSmoothing();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    camHight    = ofGetHeight();
    camWidth    = ofGetWidth();
    pixelRound = 8;
    alfa        = 100;
    
    
    videoGrabber.setVerbose(true);
    videoGrabber.initGrabber(camWidth, camHight);
}
示例#17
0
void ofApp::setup(){

    ofSetFrameRate(60);
    ofBackground(255);
    ofSetCircleResolution(100);
    ofSetVerticalSync(true);
    ofEnableSmoothing();
    ofEnableAlphaBlending();

    r = ofGetHeight() * 0.45;
    theta = 0;
    
}
示例#18
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;
}
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofBackground(0);
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    
    numSeeds = (int)ofRandom(30,50);
    for (int i = 0; i < numSeeds; i++){
        Seed tempSeed;
        tempSeed.setup();
        seeds.push_back(tempSeed);
    }
}
示例#20
0
文件: App.cpp 项目: tangible/YES-NO
//--------------------------------------------------------------
void App::draw(){
	
	glDisable(GL_DEPTH_TEST);
	glDisable(GL_LIGHTING);
	glDisableClientState(GL_COLOR_ARRAY);
	ofEnableAlphaBlending();
	ofEnableSmoothing();	
	if (isVidBG) {
		bgPlayer->draw(ofGetScreenWidth()/2-bgPlayer->getWidth()/2, 
					   ofGetScreenHeight()/2-bgPlayer->getHeight()/2);
	}else {
		bg.draw(ofGetScreenWidth()/2-bg.getWidth()/2, 
				ofGetScreenHeight()/2-bg.getHeight()/2);		
	}
	
	ofPushMatrix();
	ofSetupScreen();
	glDisable(GL_DEPTH_TEST);
	glDisable(GL_LIGHTING);		
	ofEnableSmoothing(); 	
	ofEnableAlphaBlending();
	ofSetColor(255, 255, 255);
	qImage.draw();
	glDisable(GL_CULL_FACE);	
	ofEnableSmoothing(); 
	sText.drawWithNoScale(upInfo);	
	glEnable(GL_LIGHTING);
	glEnable(GL_CULL_FACE);
	glEnable(GL_DEPTH_TEST);
	ofPopMatrix();
	
	cam.place();
	//cam.draw();
	convexHull.draw();		

	adminPanel.draw();	
	ofSetColor(255, 255, 255);	

}
示例#21
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetVerticalSync(true);
    ofEnableSmoothing();
    path = new ofxSuperPath();
    path->reset();
    
    img = new ofImage();
    img->loadImage("beach.png");
    
    marking = NULL;
    brush = NULL;
    paint = NULL;
}
void testApp::setup(){

    ofSetFrameRate(30);
    ofBackground(255);
    ofSetVerticalSync(true);
    ofEnableSmoothing();
    ofEnableAlphaBlending();
    glEnable(GL_DEPTH_TEST);
    
    angle = 0;
    aVelocity = 0.03;
    amplitude = 300;    
}
示例#23
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetVerticalSync(true);
    
    //load the image
    surf.loadImage("images/test.jpg");
    
    ofSetBackgroundAuto(false);
    ofSetFrameRate(60);
    ofEnableSmoothing();
    ofEnableAlphaBlending();
    ofBackground(0);

}
示例#24
0
//--------------------------------------------------------------
void kinectUIApp::setup(){
    ofSetWindowTitle("kinectUI");
	ofSetLogLevel(OF_LOG_VERBOSE);
	ofSetFrameRate(60);
	ofEnableAlphaBlending();
	ofEnableSmoothing();

    setupUIApp();

    flip_kinect = false;
    setupKinect();
    setupUIKinect();
}
//--------------------------------------------------------------
void ofAppKinectSample::setup(){
	//ofSetVerticalSync(true);
	ofBackground(255, 255, 255);
	// ofSetFullscreen(true);
	ofEnableAlphaBlending();
	ofEnableSmoothing();
	ofSetBackgroundAuto(true);

	kinect = new ofKinectV2Sensor();

	if (!kinect->init())
		exit();
}
示例#26
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofEnableSmoothing();
    ofEnableAlphaBlending();
    
    ofBackground(255);
    ofSetBackgroundAuto(false);
	
    ofSetFrameRate(60);
    
    location.set(100,100);
    velocity.set(2.5, 5);
}
示例#27
0
//--------------------------------------------------------------
void testApp::setup(){
    
    ofSetCircleResolution(100);
    ofEnableSmoothing();
    ofBackground(0);
//
    x = ofGetWindowWidth()/2;
    y = ofGetWindowHeight()/2;
    h = 100;
    w = 100;
    bounce = ofGetWindowHeight()-100-h;

}
示例#28
0
//--------------------------------------------------------------
void testApp::setup(){

	ofBackground(10, 100, 140);
    ofSetVerticalSync(true);				// lock to monitor
	
	spoutreceiver	= new SpoutReceiver;	// Create a new Spout receiver

	bInitialized	= false;				// Spout receiver initialization
	g_Width			= 320;					// set global width and height to something
	g_Height		= 240;					// they need to be reset when the receiver connects to a sender
	SenderName[0]	= NULL;					// the name will be filled when the receiver connects to a sender
	
	ofSetWindowTitle("OF Spout SDK Receiver");
	ofSetWindowShape(g_Width, g_Height);			// Set the initial window size

	// Allocate a texture for shared texture transfers
	// An openFrameWorks texture is used so that it can be drawn.
	myTexture.allocate(g_Width, g_Height, GL_RGBA);	

	ofEnableAlphaBlending();
	ofEnableSmoothing();
	ofSetFrameRate(60);
	ofSetVerticalSync(true);

	puffersphere = new ofxPuffersphere();
	puffersphere->offaxisLocation = "shaders/offaxis";
	puffersphere->spherizeLocation = "shaders/spherize";
	puffersphere->setup(1000 / 1.2);

	puffersphere->addGuiParams();
	rot = 0;
	gui.addSlider("rotate", rot, 0, 360);

	//create assets like this if you're using normal images
	//fullscaleBG = puffersphere->createObject("spherical.png");
	//videoQuad = puffersphere->createObject("video_frame.png");

	//videoQuad->scale = ofVec2f(.5, .5);

	//but if you're using your own, then do it like this:
	o = puffersphere->createObject();


	//ofxPuffersphere manages all the internal objects so when you call ->render and ->draw they all show up

	hideGui = false;

	gui.loadFromXML();
	gui.toggleDraw();

} // end setup
示例#29
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofBackground(0,0,0);
    ofEnableSmoothing();
    
    ofSetFrameRate(60);
    videoWidth =  640;
    videoHeight = 480;
    
    
    setVideoSize();
    if(MOVIE_DEBUG_MODE){
        //movie
        movie.loadMovie("debugmov1.mov");
        movie.play();
    }else {
        //Setting of WebCam
        cam.setVerbose(true);
        cam.setDeviceID(USE_CAMERA_ID);
        cam.initGrabber(actVideoWidth, actVideoHeight);
    }
    
    //setup of gui
    int guiMargin = 10;
    float guiW = 300;
    float guiH = ofGetHeight() - guiMargin*2;
    ofxGuiSetDefaultWidth(guiW);
    ofxGuiSetDefaultHeight(18);
    
    gui.setup();
    gui.add(minRadius.setup("MinRadius", 1, 10, 50));
    gui.add(maxRadius.setup("MaxRadius", 100, 10, 500));
    gui.add(minArea.setup("minArea",10,0,50));
    gui.add(maxArea.setup("maxArea",5500,40,5500));
    gui.add(mThreshold.setup("Threshold", 15, 0, 255));
    gui.setPosition(guiMargin, guiMargin);
    
    
    contourFinder.setMinAreaRadius(minRadius);
    contourFinder.setMaxAreaRadius(maxRadius);
    contourFinder.setThreshold(mThreshold);
    // wait for half a frame before forgetting something
    contourFinder.getTracker().setPersistence(15);
    // an object can move up to 32 pixels per frame
    contourFinder.getTracker().setMaximumDistance(32);
    
    showLabels = true;
    
    
    //指定したIPアドレスとポート番号でサーバーに接続
    sender.setup( HOST, PORT );
}
//--------------------------------------------------------------
void ofApp::setup(){

	ofSetFrameRate(60);
	ofSetVerticalSync(true);
	ofEnableSmoothing();
	ofSetWindowTitle("Orbital Tracker");
	ofEnableLighting();
	ofSetFullscreen(true);

	Tweenzor::init();

	//earth sphere
	rot = 0;
	scaler = 300 / ofx::Geo::GeoUtils::EARTH_RADIUS_KM;
	if(colorMap.load("images/color_map_1024.jpg")) ofLogVerbose() << "earth image loaded!"; else ofLogError() << "failed to load earth image!";
	earthSphere.set(ofx::Geo::GeoUtils::EARTH_RADIUS_KM, 36);
	ofQuaternion quat;
	quat.makeRotate(180, 0, 1, 0);
	earthSphere.rotate(quat);
	earthSphere.mapTexCoords(0, colorMap.getTexture().getTextureData().tex_u, colorMap.getTexture().getTextureData().tex_t, 0);

	//background sphere
	if(backgroundMap.load("images/starbackground.png")) ofLogVerbose() << "background image loaded!"; else ofLogError() << "failed to load background image!";
	backgroundSphere.set(ofx::Geo::GeoUtils::EARTH_RADIUS_KM*30, 36);
	backgroundSphere.mapTexCoords(0, backgroundMap.getTexture().getTextureData().tex_u, backgroundMap.getTexture().getTextureData().tex_t, 0);

	//cam and 3d settings
	cam.setRotationSensitivity(0.3,0.3,0.3);
    cam.setTranslationSensitivity(0.2,0.2,0.2);
	cam.setPosition(0, 0, 0);
	cam.setFarClip(100000);
	ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL_BILLBOARD);

	//initialize manager
	Manager.setup();

	//zoom
#ifdef TARGET_ANDROID
	ofAddListener(ofxAndroidEvents().scaleBegin ,this,&ofApp::scale);
#endif
    previousDistance = 0;
    zoomDistance = 1000;

    //sun
    sun.setup();
    sun.setSpotlight(40, 5);
	sunTimer = ofGetElapsedTimeMillis()+500;

	//UI
	interface.setup(&Manager);
}