示例#1
0
//--------------------------------------------------------------
void testApp::setup() {
	ofSetVerticalSync(true);
	ofBackgroundHex(0xfdefc2);
	ofSetLogLevel(OF_LOG_NOTICE);
	
	ofHideCursor();
    loadSettings("settings.xml");
	receiver.setup( port );	
	box2d.init();
	box2d.setGravity(0, 20);
	box2d.createGround();
	box2d.setFPS(30.0);
	box2d.registerGrabbing();
	

		polyLine.addVertex(ofGetWidth(), 0);
        polyLine.addVertex(3529, 0);
        polyLine.addVertex(2469, ofGetHeight());
        polyLine.addVertex(1269, ofGetHeight());
        polyLine.addVertex(672, 702);
        polyLine.addVertex(672, 0);
        polyLine.addVertex(0, 0);
	
	// make the shape
	polyLine.setPhysics(0.0, 0.0, 0.3);
	polyLine.create(box2d.getWorld());		
	 backgroundimg.loadImage("images/vimeoarcadeC.png");
}
示例#2
0
//--------------------------------------------------------------
void testApp::setup(){
	ofBackgroundHex(0xfdefc2);
	ofSetLogLevel(OF_LOG_NOTICE);
	ofSetVerticalSync(true);
	
	// Box2d
	box2d.init();
	box2d.setGravity(0, 20);
	box2d.createGround();
	box2d.setFPS(30.0);
	
	
	
	// load the shape we saved...
	vector <ofVec2f> pts = loadPoints("shape.dat");
	ofxBox2dPolygon poly;
	
	// loop and add vertex points
	for (int i=0; i<pts.size(); i++) {
		poly.addVertex(pts[i]);
	}
	poly.setAsEdge(false);
	poly.triangulate(15);
	poly.setPhysics(1.0, 0.3, 0.3);
	poly.create(box2d.getWorld());
	triangles.push_back(poly);
}
 void background(int rgb)
 {
     if( rgb > 255 )
         ofBackgroundHex(rgb);
     else
         ofBackground(rgb);
 }
示例#4
0
//--------------------------------------------------------------
void ofApp::setup() {
    ofBackgroundHex(0xc5c9b2);
    
    bTimerReached = false;
    startTime = ofGetElapsedTimeMillis();  // get the start time
    endTime = (int)ofRandom(1000, 5000); // in milliseconds
}
示例#5
0
//--------------------------------------------------------------
void testApp::setup() {
    
    ofBackgroundHex(0xff72a1);
    ofSetFrameRate(30);
    
    nextLetterTime = ofGetElapsedTimeMillis();
    lineCount      = 0;
    letterCount    = 0;
    
    // this is our buffer to stroe the text data
    ofBuffer buffer = ofBufferFromFile("ohplaces.txt");
    
    if(buffer.size()) { 
                
        // we now keep grabbing the next line
        // until we reach the end of the file
        while(buffer.isLastLine() == false) {
            
            // move on to the next line
            string line = buffer.getNextLine();
            
            // copy the line to draw later
            // make sure its not a empty line
            if(line.empty() == false) {
                seussLines.push_back(line);
            }
            
            // print out the line
            cout << line << endl;
            
        }
        
    }
    
}
示例#6
0
//--------------------------------------------------------------
void testApp::setup() {
    
 
    ofDisableAntiAliasing();
	ofBackgroundHex(0x1F2C30);
	ofSetLogLevel(OF_LOG_NOTICE);
	
    // scrolling ground
    groundSpeed = 0.02;
    groundTimer = 0;
    groundRes   = 50;
    
    // build the ground first
    for(int i=0; i<groundRes; i++) {
        float x = ofMap(i, 0, groundRes-1, 0, ofGetWidth());
        float y = ofGetHeight()/2 + ofRandom(-30, 100);
        groundLine.addVertex(x, y);
    }

	
	box2d.init();
	box2d.setGravity(0, 20);
	box2d.setFPS(60.0);
	box2d.registerGrabbing();
}
void testApp::setup() {
	// 画面設定
	ofBackgroundHex(0x000000);
	glEnable(GL_DEPTH_TEST);
	
	// カメラ設定
	zoomTarget = zoom = 2000;
	cam.setDistance(zoom);
	
	// 頂点情報の初期化
	for (int i=0; i<NUM_BILLBOARDS; i++) {
		
		// 移動速度
		billboardVels[i].set(ofRandomf(), -1.0, ofRandomf());
		
		// 初期位置
		billboardVerts[i].set(ofRandom(-500, 500), ofRandom(-500, 500), ofRandom(-500, 500));
		
		// 色
		billboardColor[i].set(1, 1, 1, 0.7);
	}
	
	// VBOにパーティクルの色と座標を格納
	billboardVbo.setVertexData(billboardVerts, NUM_BILLBOARDS, GL_DYNAMIC_DRAW);
	billboardVbo.setColorData(billboardColor, NUM_BILLBOARDS, GL_DYNAMIC_DRAW);
	
	// テクスチャー画像を設定
	ofDisableArbTex();
	texture.loadImage("particle32.png");
}
//--------------------------------------------------------------
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;
    
}
示例#9
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofBackgroundHex(0x000000);
	ofSetHexColor(0xffffff);
	background.draw(0,0,ofGetWidth(),ofGetHeight());
	
	glEnable(GL_DEPTH_TEST);
	
	camera.begin();
	ofPushMatrix();
	{
		ofTranslate(0, -80);
		ofRotate(rotate, 0, 1, 0);
		ofScale(1, 1, 1);

		// draw tracker
		glDisable(GL_DEPTH_TEST);
		ofEnableBlendMode(OF_BLENDMODE_ADD);
		
		//ofSetColor(ofColor::white, 80);
		for (int i = 0; i < trackers.size(); i++){
			trackers[i]->draw();
		}

	}
	ofPopMatrix();
	camera.end();

}
示例#10
0
//--------------------------------------------------------------
void testApp::setup() {
    
 
	ofDisableAntiAliasing();
	ofBackgroundHex(0x1F2C30);
	ofSetLogLevel(OF_LOG_NOTICE);

	
	box2d.init();
	box2d.setGravity(0, 10);
	box2d.setFPS(60.0);
	box2d.registerGrabbing();
    box2d.createGround();
    
    ground.setPhysics(0, 0, 0);
    ground.setup(box2d.getWorld(), ofGetWidth()/2, ofGetHeight()+200, 400);
    
    groundMesh.setUsage(GL_STATIC_DRAW);
    groundMesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
    for(int i=0; i<100; i++) {
        float t = ofMap(i, 0, 99, 0.0, TWO_PI);
        ofVec3f v(ofGetWidth()/2, ofGetHeight()+200);
        groundMesh.addVertex(v);
        v.x += cos(t)*400;
        v.y += sin(t)*400;
        groundMesh.addVertex(v);
    }
}
示例#11
0
//--------------------------------------------------------------
void ofApp::setup(){
		ofBackgroundHex(0x000000);

	ofSetFrameRate(60);
	ofSetVerticalSync(true);
	ofDisableArbTex();

	int camDist  = 100;
	camera.setDistance(camDist);


	ofLoadImage(texture, "dot.png");

	int total = (int)swarm.positions.size();
	vbo.setVertexData(&swarm.positions[0], total, GL_STATIC_DRAW);
	vbo.setNormalData(&swarm.sizes[0], total, GL_STATIC_DRAW);


		// load the shader
	#ifdef TARGET_OPENGLES
		cout << "shader" << endl;
        shader.load("shaders_gles/shader");
	#else
   		cout << "shader2" << endl;
        shader.load("shaders/shader");
    #endif
}
//--------------------------------------------------------------
void testApp::setup() {
    ofSetFrameRate(60);
    ofBackgroundHex(0x000000);
    
	ofSoundStreamSetup(2, 0, this, 44100, 2048, 4);
    pd.init(2, 0, 44100);
    pd.stop();
    Patch patch = pd.openPatch("fm.pd");
}
void testApp::setup() {
	ofSetVerticalSync(true);
	ofBackgroundHex(0x000000);
	
	box2d.init(); // Box2Dの世界の初期化
	box2d.setGravity(0, 0); // 無重力に
	box2d.createBounds(); // 地面を生成
	box2d.setFPS(30.0); // Box2Dの世界でのFPS
	box2d.registerGrabbing(); // 物体に接触可能に
}
示例#14
0
//--------------------------------------------------------------
void testApp::setup(){
    
	ofSetFrameRate(24);
	ofSetWindowShape(640, 480);
    ofBackgroundHex(0xEFDC9E);
    ofSetCircleResolution(100);
    
    
	circleRadius = 200;
}
//--------------------------------------------------------------
void testApp::setup(){
    
	ofSetFrameRate(24);
	ofSetWindowShape(640, 480);
    ofBackgroundHex(0xEFDC9E);
    ofSetVerticalSync(true);
    ofEnableAlphaBlending();
    ofSetCircleResolution(50);
    
    // Load in the song
    string song = "10 Ignition (Remix).mp3";
    songPlayer.loadSound(song);
    
    /**
     Upload a track to Echonest using: (this could be built into the app, but I'm lazy)
     curl -F "api_key=OHIGAA8TFWUEWMX6K" -F "filetype=mp3" -F "[email protected]" "http://developer.echonest.com/api/v4/track/upload"
     */
    
    
    // Get the profile of the song.
    // It contains the artits, title, and also the URL to the full audio analysis
    string apiKey = "OHIGAA8TFWUEWMX6K";
    string md5 = (new md5wrapper())->getHashFromFile(ofToDataPath(song));
    string url = "http://developer.echonest.com/api/v4/track/profile?api_key="+apiKey+"&format=json&md5="+md5+"&bucket=audio_summary";
    profile.open(url);
    ofLogNotice() << url;
    
    
    // Fetch the information from the song profile.
    artist = profile["response"]["track"]["artist"].asString();
    title = profile["response"]["track"]["title"].asString();
    complete = profile["response"]["track"]["status"].asString() == "complete";
    
    if(complete)
    {
        analysis_url = profile["response"]["track"]["audio_summary"]["analysis_url"].asString();
        ofLogNotice() << analysis_url;
        
        // Now open the full analysis
        analysis.open( analysis_url );
        
        cout << "found " << analysis["sections"].size() << " sections" << endl;
        cout << "found " << analysis["bars"].size() << " bars" << endl;
        cout << "found " << analysis["beats"].size() << " beats" << endl;
        cout << "found " << analysis["tatums"].size() << " tatums" << endl;
        cout << "found " << analysis["segments"].size() << " segments" << endl;
    }
    else
    {
        ofLogNotice() << "not done analyzing";
    }
    
    font.loadFont("cool.ttf", 14);
}
示例#16
0
//--------------------------------------------------------------
void testApp::draw() {

    ofBackgroundHex(0x333333);

    ofNoFill();
    ofSetColor(255, 255, 255);
    
    bgImage.draw(0,0);
    
  //  myFont.drawString(typeString, 100, 100);

    
    ofFill();

    // draw "pegs" at different category attraction points
//	for (int i=0; i<numCategories; i++) {
//        ofSetHexColor(0x282828);
//        ofCircle(centerPoints[i].x, centerPoints[i].y, 8);
//    }
    
    for(int i=0; i < emails.size(); i++){
        emails[i].drawMePlease();
    }

    for(int i=0; i < emails.size(); i++){
        if(emails[i].isHovering && emails[i].isSaved == false) {
            emails[i].hoverTitle(myFontMed, myFontSmall);
        }
        if(emails[i].isSaved && emails[i].getPosition().x < emails[i].getRadius() + 5){
            emails[i].displaySavedTitle(myFontSmall);
        }
        if(emails[i].showSavedAb){
            emails[i].displaySavedAbstract(myFontSmall);
        }
    }

    
	ofSetHexColor(0x999999);
	
	string info = "";
	info += ofToString(emails.size())+"\n";
    myFont.drawString(info, ofGetWidth()-70, 47);	
    
    info = ofToString(saved) +"\n";
    myFont.drawString(info, ofGetWidth()-42, 46+29);

    info = ofToString(trash) +"\n";
    myFont.drawString(info, ofGetWidth()-64, 46+2*29);	
    
    info = ofToString(numCategories) +"\n";
    myFont.drawString(info, ofGetWidth()-82, 46+4*29-2);	
    
	
}
示例#17
0
文件: testApp.cpp 项目: tevnin/algoHW
//--------------------------------------------------------------
void testApp::setup() {
	
	ofBackgroundHex(0x000000);
	ofSetLogLevel(OF_LOG_NOTICE);
	ofSetVerticalSync(true);
	
	// Box2d
	box2d.init();
	box2d.setGravity(0, 20);
	box2d.createGround();
	box2d.setFPS(30.0);
    
    // register the listener so that we get the events
	ofAddListener(box2d.contactStartEvents, this, &testApp::contactStart);
	ofAddListener(box2d.contactEndEvents, this, &testApp::contactEnd);
    

    // load the soundfile
	for (int i=0; i<N_SOUNDS; i++) {
		sound[i].loadSound("Electronic_Chime-KevanGC-495939803.mp3");
        sound[i].setVolume(1);
		sound[i].setMultiPlay(true);
		sound[i].setLoop(false);
	}

	
	// load the lines we saved...
	ifstream f;
	f.open(ofToDataPath("lines.txt").c_str());
	vector <string> strLines;
	while (!f.eof()) {
		string ptStr;
		getline(f, ptStr);
		strLines.push_back(ptStr);
	}
	f.close();
	
	for (int i=0; i<strLines.size(); i++) {
		vector <string> pts = ofSplitString(strLines[i], ",");
		if(pts.size() > 0) {
			ofxBox2dPolygon poly;
			for (int j=0; j<pts.size(); j+=2) {
				if(pts[j].size() > 0) {
					float x = ofToFloat(pts[j]);
					float y = ofToFloat(pts[j+1]);
					poly.addVertex(x, y);
				}				
			}
			poly.create(box2d.getWorld());
			polyLines.push_back(poly);
		}
	}
	
}
void testApp::setup(){
	
	//画面設定
	ofBackgroundHex(0x000000);
	ofEnableAlphaBlending();
	glEnable(GL_DEPTH_TEST);
	cam.setDistance(100);
	
	//シェーダー読込み
	shader.load("gradient");
}
示例#19
0
//--------------------------------------------------------------
void ofApp::setup() {
	ofSetVerticalSync(true);
	ofBackgroundHex(0xfdefc2);
	ofSetLogLevel(OF_LOG_NOTICE);
	
	box2d.init();
	box2d.setGravity(0, 10);
	box2d.createBounds();
	box2d.setFPS(60.0);
	box2d.registerGrabbing();
}
示例#20
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetVerticalSync(true);
    ofBackgroundHex(0x00000);
    
    box2d.init(); //初期化
    box2d.setGravity(0,20); //重力を下向きに設定
  //  box2d.createBounds(); // 地面を生成
    box2d.createGround();
    box2d.setFPS(30.0); // Box2Dの世界のFPS
    box2d.registerGrabbing(); // 物体に接触可能にする

}
示例#21
0
文件: ofApp.cpp 项目: Mana-Hanno/oF
//--------------------------------------------------------------
void ofApp::setup(){
    ofBackgroundHex(0x000000);
    cam.setDistance(100);
    
    for (int i = 0; i < WIDTH; i++) {
        for (int j = 0; j < HEIGHT; j++) {
            Verts[j * WIDTH + i].set(i-WIDTH/2, j-HEIGHT/2, 0);
            Color[j * WIDTH + i].set(0.5, 0.8, 1.0, 1.0);
        }
    }
    Vbo.setVertexData(Verts, NUM_PARTICLES, GL_DYNAMIC_DRAW);
    Vbo.setColorData(Color, NUM_PARTICLES, GL_DYNAMIC_DRAW);
}
//--------------------------------------------------------------
void testApp::setup() {
    
    ofBackgroundHex(0x57554c);
    ofSetFrameRate(60);
    ofSetVerticalSync(true);
    
    
    // slow       = 1
    // faster     = 2
    // super fast = 3
    mode = 1;
    
}
示例#23
0
//--------------------------------------------------------------
void ofApp::setup() {
	
	ofBackgroundHex(0xfdefc2);
	ofSetLogLevel(OF_LOG_NOTICE);
	ofSetVerticalSync(true);
	ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL);
	
	// Box2d
	box2d.init();
	box2d.setGravity(0, 0);
	box2d.createBounds();
	box2d.setFPS(60.0);
}
示例#24
0
void testApp::setup(){
    ofSetFrameRate(60);
    ofBackgroundHex(0xaaaaaa);
    easyCam.setDistance(22);

    ofSetLineWidth(3);
    
    ofSetVerticalSync(true);
    
	// this uses depth information for occlusion
	// rather than always drawing things on top of each other
	glEnable(GL_DEPTH_TEST);
	
	// ofBox uses texture coordinates from 0-1, so you can load whatever
	// sized images you want and still use them to texture your box
	// but we have to explicitly normalize our tex coords here
	ofEnableNormalizedTexCoords();
    
    //create a bunch of custom nodes
    for(double z = 0; z > -36*M_PI; z +=zStep){
        double x = -10;
        double y = tileLayoutFunction(z);
        double blueValue = fmod(-floor(z*2),255);

        CustomNode* node = new CustomNode();
        node->setPosition(x, y, z);
        node->red = 0;
        node->green = 60;
        node->blue = blueValue;
        customNodes.push_back(node);
        
    }
    firstNodePosition = customNodes[0]->getPosition();
    lastNodePosition = customNodes[customNodes.size()-1]->getPosition();
    
    
    light.enable();
    light.setPosition(0, 0, 150);
    light.setDirectional();
    ofFloatColor ambient_color(1.0, 0.0, 0.0,1.0);
    ofFloatColor diffuse_color(1.0, 1.0, 1.0);
    ofFloatColor specular_color(0.0, 1.0, 0.0);
    light.setAmbientColor(ambient_color);
    light.setDiffuseColor(diffuse_color);
    light.setSpecularColor(specular_color);

    easyCam.disableMouseInput();
    
    

}
示例#25
0
文件: ofApp.cpp 项目: Dairaku/of_city
void testApp::setup() {
    //画面設定
    ofBackgroundHex(0x000000);
    ofSetFrameRate(60);
    
    // Kinect初期設定
    // 深度とRGB情報のずれを補整
    kinect.setRegistration(true);
    kinect.init();
    kinect.open();
    // 角度を調整(0度に)
    angle = 0;
    kinect.setCameraTiltAngle(angle);
}
void KinectCloud::setup() {
	//画面設定
	ofBackgroundHex(0x000000);
	
	//Mesh 初期設定
	rotate.x = rotate.y = rotate.z = 0;
	scale = 2.5;
	
	//cam.setFarClip(1000);
	//cam.setNearClip(0.1);
	
	easyCam.setNearClip(10.0);
	
	// テクスチャー画像を設定
	//ofDisableArbTex();
	//texture.loadImage("particle32.png");
	
	// GUI
	gui.setup("ofxKinect Point Cloud", 0, 0, 400, ofGetHeight());
	gui.addPanel("Kinect Params", 1);
	gui.setWhichPanel(0);
	gui.setWhichColumn(0);
	gui.addToggle("Pick Color", "pick_color", false);
	gui.addToggle("Blendmode Add", "blend_add", false);
	gui.addToggle("Point smooth", "point_smooth", false);
	gui.addSlider("Kinect Tilt Angle", "angle", 0, -40, 40, true);
	gui.addSlider("Point size", "point_size", 5, 1, 40, false);
	gui.addSlider("Step size", "step", 2, 1, 10, true);
	gui.addSlider("Z threshold", "thresh", 1000, 0, 4000, true);
	gui.addSlider("Mesh scale", "scale", 1.0, 0.5, 4.0, false);
	gui.addSlider("Mesh posz", "posz", 0, -2000, 2000, true);
	//gui.addSlider("Color Hue", "color_h", 1.0, 0, 4.0, false);
	gui.addSlider("Color Saturation", "color_s", 1.0, 0, 2.0, false);
	gui.addSlider("Color brightness", "color_b", 1.0, 0, 2.0, false);
	//gui.addSlider("Mesh rotate X", "rotx", 0, -100, 100, false);
	//gui.addSlider("Mesh rotate Y", "roty", 0, -100, 100, false);
	gui.addSlider("Record buffer size", "rec_size", 10, 1, 20, true);
	gui.addSlider("Record step", "rec_step", 10, 1, 20, true);
	//gui.addSlider("Point cloud random", "cloud_rand", 0.0, 0.0, 2.0, false);
	//gui.addSlider("Point cloud alpha", "cloud_alpha", 0.2, 0.0, 1.0, false);
	
	gui.addPanel("Kinect Images", 1);
	gui.setWhichPanel(1);
	gui.setWhichColumn(0);
	//gui.addDrawableRect("Kinect Cam", &kinectCam, 320, 240);
	//gui.addDrawableRect("Kinect Depth", &kinectDepth, 320, 240);
	gui.loadSettings("controlPanelSettings.xml");
	gui.toggleView();
}
示例#27
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    panel.setup("light test", "settings.xml", 0, 0);
    panel.add(specularColor.set("specularColor", ofFloatColor(0.5, 0.5, 0.5), ofFloatColor(0.0, 0.0, 0.0), ofFloatColor(1.0, 1.0, 1.0)));
    panel.add(diffuseColor.set("diffuseColor", ofFloatColor(0.5, 0.5, 0.5), ofFloatColor(0.0, 0.0, 0.0), ofFloatColor(1.0, 1.0, 1.0)));
    panel.add(ambientColor.set("ambientColor", ofFloatColor(0.5, 0.5, 0.5), ofFloatColor(0.0, 0.0, 0.0), ofFloatColor(1.0, 1.0, 1.0)));
    panel.add(sphereResolution.set("sphereResolution", 10, 2, 100));
    panel.add(sphereRadius.set("sphereRadius", 100, 1, 300));
    panel.add(enableDrawWireFrame.set("enableDrawWireFrame", false));
    panel.loadFromFile("settings.xml");
    
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    //    ofSetGlobalAmbientColor(ofColor(0, 0, 0));
    ofSetSmoothLighting(true);
    
    ofBackgroundHex(0x000000);
    ofSetSphereResolution(100);
    ofSetBoxResolution(100);
    
    camera.setDistance(600);
    
    ofLogNotice("initial light type: "+ofToString(light.getType()));
    
    // set light type
    light.setPointLight();
    light.setPosition(0, 0, 0);
    
    // for spot light
//    setLightOri(light, ofVec3f(0, 90, 0));
//    light.setSpotConcentration(0); // gradation of spot light which is between  0 ~ 128
//    light.setSpotlightCutOff(30); // cone angle of spot light which is between 0 ~ 90 (degree)
    
    // color of light for each light type
    light.setDiffuseColor(diffuseColor);
    light.setSpecularColor(specularColor);
    light.setAmbientColor(ambientColor);
    
    // color of material for each material type
    material.setShininess(128); // shininess is a value between 0 - 128, 128 being the most shiny //
    material.setSpecularColor(ofFloatColor(1.0, 1.0, 1.0));
    material.setDiffuseColor(ofFloatColor(1.0, 1.0, 1.0));
    material.setAmbientColor(ofFloatColor(1.0, 1.0, 1.0));
    
    // sphere
    sphere.set(sphereRadius, sphereResolution);
    sphere.setPosition(-200, 0, 0);
}
示例#28
0
//--------------------------------------------------------------
void testApp::setup(){

    ofSetFrameRate(24);
    ofBackgroundHex(0xEFDC9E);

    
    for(int i=0; i<NUM_PARTICLES; i++)
    {
        radius[i] = ofRandom(10, 20);
        x_pos[i] = ofRandom(radius[i], ofGetWidth()-radius[i]);
        y_pos[i] = ofRandom(radius[i], ofGetHeight()-radius[i]);
        x_vel[i] = ofRandom(-10, 10);
        y_vel[i] = ofRandom(-10, 10);
        color[i] = ofRandom(0xFFFFFF);
    }
}
示例#29
0
//--------------------------------------------------------------
void testApp::setup(){

    ofSetFrameRate(24);
    ofBackgroundHex(0xEFDC9E);

    
    for(int i=0; i<NUM_PARTICLES; i++)
    {
        radius[i] = ofRandom(10, 20);
        pos[i].x = ofRandom(radius[i], ofGetWidth()-radius[i]);
        pos[i].y = ofRandom(radius[i], ofGetHeight()-radius[i]);
        vel[i].x = ofRandom(-10, 10);
        vel[i].y = ofRandom(-10, 10);
        color[i].setHsb(ofRandom(255), 200, 200);
    }
}
void testApp::setup(){
	// 画面設定
	ofBackgroundHex(0x000000);
	cam.setDistance(100);
	
	// 頂点情報を初期化
	for (int i = 0; i < WIDTH; i++) {
		for (int j = 0; j < HEIGHT; j++) {
			myVerts[j * WIDTH + i].set(i - WIDTH/2, j - HEIGHT/2, 0);
			myColor[j * WIDTH + i].set(0.5, 0.8, 1.0, 1.0);
		}
	}
	
	// 頂点バッファに位置と色の情報を設定
	myVbo.setVertexData(myVerts, NUM_PARTICLES, GL_DYNAMIC_DRAW);
	myVbo.setColorData(myColor, NUM_PARTICLES, GL_DYNAMIC_DRAW);
}