// ------------------------------------------------------------------------------------------------------
//
void ofApp::draw()
{
	ofBackgroundGradient( ofColor(40,40,40), ofColor(0,0,0), OF_GRADIENT_CIRCULAR);
	
	if( currAppMode == APP_MODE_LIVE  )
	{
		particles.update( time, timeStep );
		
		drawScene();
		
		ofDisableDepthTest();
		
		if( drawUI )
		{
			kinectManager.debugDraw2D();
			gui.draw();
			particles.drawGui();
			opticalFlowDebugDrawer.getGui()->draw();
		}
	}
	else if ( currAppMode == APP_MODE_TOUCH_SETUP )
	{

		kinectManager.drawPointCloud();
		kinectManager.debugDraw2D();

		ofSetColor( ofColor::white );

		if( drawUI )
		{
			kinectManager.drawGui();
		}
	}
	
	string tmpStr = ofToString( kinectManager.getNumFramesProcessedPerSecond(), 1) + " " + ofToString( ofGetFrameRate(), 1 );
	fontSmall.drawStringShadowed( tmpStr, ofVec2f(ofGetWidth()-60, ofGetHeight()-10) );
}
//--------------------------------------------------------------
void testApp::draw(){
    ofBackgroundGradient(ofColor::white, ofColor::black);
    
    glEnable(GL_DEPTH_TEST);
    ofEnableLighting();
    cam.begin();
    {
        ofPushMatrix();
        {
            //ofScale(1, -1);
            ofTranslate(-(bb.getWidth()/2.0), (bb.getHeight()/2.0));
        
            for(int i=0; i<meshes.size(); i++)
            {
                if(bDrawWireframe) {
                    meshes[i].drawWireframe();
                } else {
                     meshes[i].draw();
                }
            }
        }
        ofPopMatrix();
    }
    cam.end();
    
    spotLight.draw();
    pointLight.draw();
    
    ofDisableLighting();
    glDisable(GL_DEPTH_TEST);
    
    
    ofSetColor(200, 0, 100);
    stringstream message;
    message << "DRAG YOUR MOUSE!" << endl;    message << "(w) bDrawWireframe: " << (bDrawWireframe ? "on" : "off") << endl;
    ofDrawBitmapString(message.str(), 10, ofGetHeight()-40);
}
//--------------------------------------------------------------
void testApp::draw(){
    ofBackgroundGradient(ofColor::gray, ofColor::black);
    glEnable(GL_DEPTH_TEST);
    ofEnableLighting();
        directionalLight.enable();
    cam.begin();
    ofPushStyle();
    ofSetColor(255);
    ofSetLineWidth(5);
    glPushMatrix();
    glTranslatef(SIZE*-1.5,0, SIZE*-1.5);
    ofScale(1, -1);
    for(int i = 0 ; i < NUM_DEVICE ; i ++)
    {
        
        int x = SIZE*((i%3));
        int y = -SIZE;
        int z = SIZE*((i/3.0f));
        glPushMatrix();
        glTranslatef(x, y, z);
        ofLine(0, 0, 0, dataSet[i].length);
//        ofCircle(0,dataSet[i].length,50);
        glPushMatrix();
        glTranslatef(0,dataSet[i].length,0);

        gluSphere(quadric, 50, 64, 64);
        glPopMatrix();
        glPopMatrix();
    }
    glPopMatrix();
    ofPopStyle();
    cam.end();
        directionalLight.disable();
    ofDisableLighting();
        glDisable(GL_DEPTH_TEST);
    timeline.draw();
}
//--------------------------------------------------------------
void ofApp::draw(){
//    ofEnableLighting();
    ofBackgroundGradient(ofColor(65,62,50),ofColor(25,22,10) );

    ofDisableDepthTest();
    gui.draw();
    ofEnableDepthTest(); //make sure we test depth for 3d

    
    // disable normals if a key is pressed
    if(ofGetKeyPressed() || ofGetMousePressed()){
        mesh.disableNormals();
    }else{
        mesh.enableNormals();
    }
    
    cam.begin();
    ofNoFill();
    mesh.enableColors();
    mesh.drawWireframe();
//    mesh.draw();
    mesh.disableColors();
    


    //    ofSetColor(137,137,140);
    //    ofFill();
    
    
#ifndef TARGET_OPENGLES
    glEnable(GL_POLYGON_OFFSET_LINE);
    glPolygonOffset(-1,-1);
#endif    
    
    cam.end();

}
Exemple #5
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(255, 80);
    
    ofSetColor(255,150);
    ofDrawRectangle(dimensions.x, dimensions.y, dimensions.width, dimensions.height);
    
    for (int i = 0; i < dataPoints.size(); i++){
        
        float value;
        if (which == 0) value = dataPoints[i].ny;
        if (which == 1) value = dataPoints[i].ala;
        if (which == 2) value = dataPoints[i].lou;
        
        float x = dimensions.x + ofMap( dataPoints[i].year, minYear, maxYear, 0,dimensions.width);
        float y = dimensions.y + ofMap( value, 0, maxValue, dimensions.height, 0);
        
        
        ofSetColor(ofColor::green);
        ofDrawCircle(x,y, 5);
        
        ofSetColor(255);
        labelFont.drawString(ofToString(dataPoints[i].year), x, dimensions.y+dimensions.height+15);
    }
    
    if (which == 0) ofSetColor(ofColor::salmon);
    else ofSetColor(255);
    font.drawString("New York", dimensions.x, dimensions.y-15);
    
    if (which == 1) ofSetColor(ofColor::salmon);
    else ofSetColor(255);
    font.drawString("Alabama", dimensions.x + 160, dimensions.y-15);
    
    if (which == 2) ofSetColor(ofColor::salmon);
    else ofSetColor(255);
    font.drawString("Louisana", dimensions.x + 320, dimensions.y-15);

}
Exemple #6
0
//--------------------------------------------------------------
void testApp::draw() {
	ofBackgroundGradient(ofColor(255), ofColor(230, 240, 255));
	
	string info = ofToString(ofGetFrameRate(), 2)+"\n";
	info += "Particle Count: "+ofToString(NUM_BILLBOARDS);
	ofDrawBitmapStringHighlight(info, 30, 30);
	
	ofEnableAlphaBlending();
	ofSetColor(255);
	
	ofPushMatrix();
	ofTranslate(ofGetWidth()/2, ofGetHeight()/2, zoom);
	ofRotate(cameraRotation.x, 1, 0, 0);
	ofRotate(cameraRotation.y, 0, 1, 0);
	ofRotate(cameraRotation.y, 0, 0, 1);
	
	// bind the shader so that wee can change the
	// size of the points via the vert shader
	billboardShader.begin();
	billboardShader.setUniform1fv("pointSize", billboardSize, NUM_BILLBOARDS); 
	
	ofEnablePointSprites();
	texture.getTextureReference().bind();
	billboardVbo.bind();
	billboardVbo.setVertexData(billboardVerts, NUM_BILLBOARDS, GL_DYNAMIC_DRAW);
	//billboardVbo.setColorData(billboardColor, NUM_BILLBOARDS, GL_DYNAMIC_DRAW);
	billboardVbo.draw(GL_POINTS, 0, NUM_BILLBOARDS);
	
	billboardVbo.unbind();
	texture.getTextureReference().unbind();
	ofDisablePointSprites();
	
	billboardShader.end();
	
	ofPopMatrix();
}
Exemple #7
0
void ofApp::draw()
{
    ofBackgroundGradient(ofColor::white, ofColor::black);

    int x = 0;
    int y = 0;

    for (auto& player: players)
    {
        ofPixels p = player->getPixels();

//        ofPixels stable = stabilizer.stabilize(p);

        ofTexture tex;
        tex.loadData(p);
        tex.draw(x, y);

        //        player->getTexture().draw(x, y);

        x += 100;
        y += 100;
    }

}
Exemple #8
0
//-----------------------------------------------------------------------------------------
//
void ofApp::draw()
{
	ofBackgroundGradient( ofColor::skyBlue, ofColor(255), OF_GRADIENT_LINEAR);
	
	ofEnableDepthTest();
    
    ofEnableLighting();
    pointLight.enable();
   pointLight2.enable();
   pointLight3.enable();
	camera.begin();
	
    //draw a grid
//    ofSetColor( ofColor(60));
//		ofPushMatrix();
//			ofRotate(90, 0, 0, -1);
//            ofDrawGridPlane(300);
//        ofPopMatrix();
    
    material.begin();
    
    //rotate the plane so that y axis becomes the z axis
    ofPushMatrix();
    ofRotate(90, 1, 0, 0);
    mesh.draw();
    ofPopMatrix();
	
	camera.end();

	ofSetColor( ofColor::white );
	ofDisableDepthTest();


	fontSmall.drawStringShadowed(ofToString(ofGetFrameRate(),2), ofGetWidth()-35, ofGetHeight() - 6, ofColor::whiteSmoke, ofColor::black );

}
//-----------------------------------------------------------------------------------------
//
void ofApp::draw()
{
	ofBackgroundGradient( ofColor(40,40,40), ofColor(0,0,0), OF_GRADIENT_CIRCULAR);	

	particles.update( time, timeStep );
	
	camera.begin();
	
		// draw a grid on the floor
		ofSetColor( ofColor(60) );
		ofPushMatrix();
			ofRotate(90, 0, 0, -1);
			ofDrawGridPlane( 0.5, 12, false );
		ofPopMatrix();
		 
		ofSetColor( ofColor::white );
	
		particles.draw( &camera );
	
	camera.end();
	
	ofDisableDepthTest();
	ofEnableBlendMode( OF_BLENDMODE_ALPHA );
	ofSetColor( ofColor::white );
	
	int size = 196;
	//particles.particleDataFbo.source()->getTextureReference(0).draw( 0,	 0, size, size );
	
	if( drawGui )
	{
		particles.gui.draw();
	}
	
	ofDisableDepthTest();
	fontSmall.drawStringShadowed(ofToString(ofGetFrameRate(),2), ofGetWidth()-35, ofGetHeight() - 6, ofColor::whiteSmoke, ofColor::black );
}
Exemple #10
0
//-----------------------------------------------------------------------------------------
//
void ofApp::draw()
{
	ofBackgroundGradient( ofColor(40,40,40), ofColor(0,0,0), OF_GRADIENT_CIRCULAR);	

	
	ofEnableDepthTest();
	camera.begin();
	
		// draw a grid on the floor
		ofSetColor( ofColor(60) );
		ofPushMatrix();
			ofRotate(90, 0, 0, -1);
			ofDrawGridPlane( 10, 10, false );
		ofPopMatrix();

	
	camera.end();

	ofSetColor( ofColor::white );
	ofDisableDepthTest();


	fontSmall.drawStringShadowed(ofToString(ofGetFrameRate(),2), ofGetWidth()-35, ofGetHeight() - 6, ofColor::whiteSmoke, ofColor::black );
}
Exemple #11
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofEnableLighting();
    ofSetSmoothLighting(true);
    glEnable (GL_DEPTH_TEST);

    ofColor centerColor = ofColor(255, 255, 255);
    ofColor edgeColor(250, 250, 250);
    ofBackgroundGradient(centerColor, edgeColor, OF_GRADIENT_CIRCULAR);

    camera.begin();


    //sun1.enable();
    //ofColor suncolor = ofColor(230,200,100);
    //sun1.setAmbientColor(suncolor);
    //sun1.setDiffuseColor(ofColor::blue);

    ofPushMatrix();
        float tx = ofGetWidth() / 2;
        float ty = ofGetHeight() / 2;
        ofTranslate(tx, ty);
    ofPopMatrix();

    Tank1.draw();


    if(f==false){
        Tank1.light.disable();
    }else{
    }

    ofPushStyle();
        skyimg.bind();
        ofSetColor(255,255,255);
        sky.setPosition(Tank1.xPos,Tank1.yPos,Tank1.zPos);
        //sky.draw();
    ofPopStyle();

    ofPushStyle();
        floorimg.bind();
        ofSetColor(255,255,255);
        floor.draw();
    ofPopStyle();


        ofPushStyle();
        wallimg.bind();

        ofSetColor(255,255,255);
        wall1.setPosition(-ms/2,0,wallh/2);
        wall1.draw();
        wall2.setPosition(ms/2,0,wallh/2);
        wall2.draw();
        wall3.setPosition(0,-ms/2,wallh/2);
        wall3.draw();
        wall4.setPosition(0,ms/2,wallh/2);
        wall4.draw();

        ofTranslate(-ms/2,-ms/2);
        for (std::vector<MyWall>::iterator it = vec.begin() ; it != vec.end(); ++it) {
            ofSetColor(ofColor::white);
            (*it).tree.setPosition((*it).x,(*it).y,wallh/2);
            (*it).tree.draw();
        }

        ofTranslate(ms/2,ms/2);
    ofPopStyle();

    sun1.disable();
    camera.end();

    ofDisableLighting();
    ofSetSmoothLighting(false);
    glDisable (GL_DEPTH_TEST);
}
Exemple #12
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofBackgroundGradient(ofColor::white, ofColor::gray);
}
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(ofColor(120), ofColor(170));
}
//--------------------------------------------------------------
void testApp::draw(){
    ofBackgroundGradient(ofColor(50,50,50) , ofColor::black);
}
Exemple #15
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofEnableAlphaBlending();

	float time = ofGetElapsedTimef();
	float w = ofGetWidth();
	float h = ofGetHeight();

	fbo.begin();
	
	//Draw something on the screen

	//Set a gradient background from white to gray 
	//See "Sharp sphere example" in chapter "Creating in 3D with openFrameworks"
	ofBackgroundGradient( ofColor( 255 ), ofColor( 128 ) );

	ofSetColor( 255, 255, 255 );
	image.draw( 351, 221 );

	fbo.end();

	//Draw first image
	fbo2.begin();	
	ofBackground( 0, 0, 0 );
	float ang = time * 30;
	//ang = 0;

	ofPushMatrix();
	ofTranslate( w/2, h/2 );
	ofRotate( ang );
	ofFill();
	ofSetColor( 255, 255, 255 );
	ofTriangle( -200, -114, 200, -114, 0, 230 );
	ofPopMatrix();

	fbo2.end();

	//Enable shader
	shader.begin();
	
    //pass time value to shader
	shader.setUniform1f("time", time );
			
	//we also pass in the mouse position 
	//we have to transform the coords to what the shader is expecting which is 0,0 in the center and y axis flipped. 
	//shader.setUniform2f("mouse", mouseX - ofGetWidth()/2, ofGetHeight()/2-mouseY );
	shader.setUniformTexture( "texture1", fbo2.getTextureReference(), 1 ); //"1" means that it is texture 1

	shader.setUniformTexture( "texture2", spectrumImage.getTextureReference(), 2 ); //"2" means that it is texture 2

	//shader.setUniform1i( "N", N );
	shader.setUniform1fv( "specArray", spectrum, N );

	//Draw image through shader
	ofSetColor( 255, 255, 255 );
	fbo.draw( 0, 0 );

	//ofSetColor( 255, 255, 255, 128 );
	//fbo2.draw( 0, 0 );

	shader.end();

	//Draw spectrum
/*	ofFill();
	ofSetColor( 0, 255, 0 ); 
	for (int i=0; i<N; i++) {
		ofRect( w/2 + i * 7, h/2, 7, -spectrum[i] * 100 );
	}

	ofSetColor( 255, 255, 255 );
	spectrumImage.draw( w/2, 0, N*7, 50 );
	*/
}
//--------------------------------------------------------------
void testApp::draw(){
	
	
	glShadeModel(GL_SMOOTH);
	glProvokingVertex(GL_LAST_VERTEX_CONVENTION);

	ofBackgroundGradient(ofColor::fromHsb(0, 0, 120), ofColor::fromHsb(0, 0, 0));
	
	mCamMainCam.begin();
	
	ofEnableLighting();

	mLigDirectional.setGlobalPosition(1000, 1000, 1000);
	mLigDirectional.lookAt(ofVec3f(0,0,0));

	ofEnableSeparateSpecularLight();
	
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

	mLigDirectional.enable();
	ofSetColor(mLigDirectional.getDiffuseColor());
	mMatMainMaterial.begin();

	mShdPhong->begin();

	if (shouldRenderNormals){
		mShdPhong->setUniform1f("shouldRenderNormals", 1.0);
	} else {
		mShdPhong->setUniform1f("shouldRenderNormals", 0.0);
	}

	glPushAttrib(GL_SHADE_MODEL);
	if (shouldUseFlatShading){
		mShdPhong->setUniform1f("shouldUseFlatShading", 1.0);
		glShadeModel(GL_FLAT);
		glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);		// OpenGL default is GL_LAST_VERTEX_CONVENTION
	} else {
		mShdPhong->setUniform1f("shouldUseFlatShading", 0.0);
		glShadeModel(GL_SMOOTH);
		glProvokingVertex(GL_LAST_VERTEX_CONVENTION);
	}
	
	if (shouldDrawBuiltinBox) {
		ofBox(0, 0, 0, 100);
	} else {
		ofPushMatrix();
		ofScale(50, 50,50);
		mMshCube.draw();
		ofPopMatrix();
	}
	
	// restores shade model
	glPopAttrib();
	// restores vertex convention defaults.
	glProvokingVertex(GL_LAST_VERTEX_CONVENTION);
	
	mShdPhong->end();
	
	// we revert to default values, to not end up 

	
	mMatMainMaterial.end();
	mLigDirectional.disable();

	glDisable(GL_CULL_FACE);
	glDisable(GL_DEPTH_TEST);

	ofDisableLighting();

	ofSetColor(255);
	for (int i=0; i<8; i++){
		// we do a manual scale by scaling the mesh vertex coord by 50.f to render the point at the vertex position
		ofDrawBitmapString(ofToString(i), mMshCube.getVertex(i) * 50.0f);
	}

	mCamMainCam.end();

	// draw HUD items outside of camera.
	
	string builtInIndicator = ((shouldDrawBuiltinBox) ? "built-in" : "mesh-based");
	ofDrawBitmapStringHighlight( "Rendering " + builtInIndicator + " box. Press 'b' to toggle."  , ofVec3f(10,20), ofColor(255), ofColor(0));
	
	string normalsIndicator = ((shouldRenderNormals) ? "normals" : "faces");
	ofDrawBitmapStringHighlight( "Showing " + normalsIndicator + ". Press 'n' to toggle."  , ofVec3f(10,40), ofColor(255), ofColor(0));

	string flatShadingIndicator = ((shouldUseFlatShading) ? "on" : "off");
	ofDrawBitmapStringHighlight( "Flat Shading is " + flatShadingIndicator + ". Press 'f' to toggle."  , ofVec3f(10,60), ofColor(255), ofColor(0));

	ofDrawBitmapStringHighlight( "Press SPACEBAR to reload shader."  , ofVec3f(10,80), ofColor(0), ofColor(255));

}
//--------------------------------------------------------------
void ofApp::draw(){
	ofBackgroundGradient( ofColor(240), ofColor(180), OF_GRADIENT_CIRCULAR);
	renderMultibandNoiseDemo();
}
Exemple #18
0
//--------------------------------------------------------------
void testApp::draw(){
    
    float templatesScale = 0.5f;
    ofBackgroundGradient(ofColor(2), ofColor(40), OF_GRADIENT_CIRCULAR);
    ofPushMatrix();
    
    if(rotate)
    {
        // rotate gesture related graphics around the center of the screen
        ofTranslate(scrW/2, scrH/2);
        ofRotateY(viewYRotation);
        ofRotateX(viewXRotation);
        ofTranslate(-scrW/2, -scrH/2);
    }
    
    // draw the current templates on a small scale
    gvfh.drawTemplates(templatesScale);
    
    
    if(gvfh.get_state() != STATE_FOLLOWING && isMouseDrawing)
        currentGesture.draw();
    else if(displayCurrentGesture)
        currentGesture.draw();
    
    ofDisableAlphaBlending();

    // string used to comunicate to the user of possible commands and of the current state of the application

    string state_string;
    state_string.append("'l' to learn a new template\n'c' to clear\n"
                        "numbers 1 to 4 to toggle visual feedback "
                        "(1 - particles; 2 - template; 3 - estimated gesture; 4 - current gesture)"
                        "\nSTATE_LEARINING [");
    
    int state = gvfh.get_state();
    if(state == STATE_FOLLOWING){
        state_string.append(" ]\nSTATE_FOLLOWING [X]\nSTATE_CLEAR     [ ]");
        
        if(displayParticles)
            gvfh.printParticleInfo(currentGesture);

        // temp will have the partial representation of how gvf is recognising the gesture being performed
        gvfGesture temp = gvfh.getRecognisedGestureRepresentation();
        if(temp.isValid)
        {
            // the estimated gesture will be drawn on the same area
            // as the gesture being performed and starting on the same point
            ofRectangle da = currentGesture.getDrawArea();
            ofPoint p = currentGesture.getInitialOfPoint();
            
            if(displayEstimatedGesture)
            {
                temp.setAppearance(ofColor(0,255,0), 5, 255, 180, 1);
                temp.draw(templatesScale);
                
                temp.setDrawArea(da);
                temp.setInitialPoint(p + 1);
                temp.centraliseDrawing = false;
                temp.draw();
            }
            
            if(displayTemplate)
            {
                // draw the original template for the gesture being recognised
                gvfGesture g = gvfh.getTemplateGesture(gvfh.getIndexMostProbable());
                g.setDrawArea(da);
                g.setInitialPoint(p + 1);
                g.centraliseDrawing = false;

                // the template's opacity is determined by how probable the recognition is
                g.setAppearance(g.getColor(),
                                1.5, 255, 50,
                                ofLerp(1/gvfh.getTemplateCount(),
                                1,
                                gvfh.getRecogInfoOfMostProbable().probability));
               g.draw();
            }
        }
        
    }else if (state == STATE_LEARNING)
        state_string.append("X]\nSTATE_FOLLOWING [ ]\nSTATE_CLEAR     [ ]");
    else
        state_string.append(" ]\nSTATE_FOLLOWING [ ]\nSTATE_CLEAR     [X]");
    
    ofPopMatrix();
    
    ofSetColor(198);
    
    ofDrawBitmapString(state_string.c_str(), 30, 25);

    // show the current frame rate
    ofDrawBitmapString("FPS " + ofToString(ofGetFrameRate(), 0), ofGetWidth() - 200, 25);
}
//--------------------------------------------------------------
void testApp::draw(){
	ofDisableLighting();
    ofBackgroundGradient(ofColor(90, 90, 90), ofColor(30, 30, 30),  OF_GRADIENT_BAR);
	
	ofSetColor(200);
	ofDrawBitmapString("ofxLeapMotion - Example App\nLeap Connected? " + ofToString(leap.isConnected()), 20, 20);
    
	cam.begin();
    
	ofPushMatrix();
    ofRotate(90, 0, 0, 1);
    ofSetColor(20);
    ofDrawGridPlane(800, 20, false);
	ofPopMatrix();
	
	ofEnableLighting();
	l1.enable();
	l2.enable();
	
	m1.begin();
	m1.setShininess(0.6);
	
	for(int i = 0; i < fingersFound.size(); i++){
		ofxStrip strip;
		int id = fingersFound[i];
		
		ofPolyline & polyline = fingerTrails[id];
		strip.generate(polyline.getVertices(), 15, ofPoint(0, 0.5, 0.5) );
		
		ofSetColor(255 - id * 15, 0, id * 25);
		strip.getMesh().draw();
	}
	
    l2.disable();
    
    for(int i = 0; i < simpleHands.size(); i++){
        simpleHands[i].debugDraw();
    }
    
	m1.end();
	cam.end();
	
    
    for(int i=0; i<circles.size(); i++) {
		ofFill();
		ofSetHexColor(0x90d4e3);
		circles[i].get()->draw();
	}
	
	for(int i=0; i<boxes.size(); i++) {
		ofFill();
		ofSetHexColor(0xe63b8b);
		boxes[i].get()->draw();
	}
	
	for(int i=0; i<customParticles.size(); i++) {
		customParticles[i].get()->draw();
	}
	
	ofNoFill();
	ofSetHexColor(0x444342);
	if(drawing.size()==0) {
        edgeLine.updateShape();
        edgeLine.draw();
    }
	else drawing.draw();
	
	
	string info = "";
	info += "Press [s] to draw a line strip ["+ofToString(bDrawLines)+"]\n";
	info += "Press [f] to toggle Mouse Force ["+ofToString(bMouseForce)+"]\n";
	info += "Press [c] for circles\n";
	info += "Press [b] for blocks\n";
	info += "Press [z] for custom particle\n";
	info += "Total Bodies: "+ofToString(box2d.getBodyCount())+"\n";
	info += "Total Joints: "+ofToString(box2d.getJointCount())+"\n\n";
	info += "FPS: "+ofToString(ofGetFrameRate())+"\n";
	ofSetHexColor(0x444342);
	ofDrawBitmapString(info, 30, 30);
}
Exemple #20
0
//--------------------------------------------------------------
void testApp::draw(){
  //  ofBackground(50, 50, 50);
//    ofBackground(80,80,20);
    ofBackgroundGradient( ofColor(180), ofColor(0), OF_GRADIENT_CIRCULAR);
   // ofSetColor(245, 58, 135);
   ofColor color = ofColor(100,100,100);
    //int temp=animationRefs[set].x+ofRandom(animationRefs[set].y-animationRefs[set].x);
    for(vector<paperclip>::iterator it = copias.begin(); it != copias.end(); ++it){
        if((it)->alive){
        (it)->draw(color);
        }
    }
    //SOUND
    static int index=0;
	float avg_power = 0.0f;
    
    myfft.powerSpectrum(0,(int)BUFFER_SIZE/2, left,BUFFER_SIZE,&magnitude[0],&phase[0],&power[0],&avg_power);
	
	/* start from 1 because mag[0] = DC component */
	/* and discard the upper half of the buffer */
	for(int j=1; j < BUFFER_SIZE/2; j++) {
		freq[index][j] = magnitude[j];
	}
	
	/* draw the FFT */
	for (int i = 1; i < (int)(BUFFER_SIZE/2); i++){
        ofLine(200+(i*8),400,200+(i*8),400-magnitude[i]*10.0);
		ofLine(200+(i*8),400,200+(i*8),400+magnitude[i]*10.0);
        //int sl = ofMap( magnitude[i]*10.0, 0, 500, 0, animationRefs[set].z);
        
        
     //   cout <<"  "<< magnitude[i]*10.0 << " " ;
//        if (magnitude[i]) {
//            statements
//        }
	}
    if (magnitude[20]*10>50) {
        advanceOne(select);
    }
    
    
	///INFO
    string info = infoarray;
	info += "Press [1] select- ["+ofToString(select)+"]\n";
	info += "Press [0] set+ ["+ofToString(set)+"]\n";

	info += "GLITCHY?: "+ofToString(copias[select].glitch)+"\n";
    info +="SETIMAGES FROM: "+ofToString(animationRefs[set].x)+" TO: "+ofToString(animationRefs[set].y)+"\n";
    info +="nSetImages: "+ofToString(animationRefs[set].z)+"\n";
    info += "NIMage "+ofToString(nImage)+"\n";

    info += "IMAGE "+ofToString(imagePaths[animationRefs[set].x+nImage])+"\n";
    info += "nShader "+ofToString(nShader)+"\n";

    info += "SHADER "+ofToString(shaderFiles[nShader])+"\n\n";
    ofSetHexColor(0x000000);
    ofRect(10, 10, 250, 150);
	ofSetHexColor(0xFFFFFF);
	ofDrawBitmapString(info, 30, 30);
    rooom.drawString("", 300, 350);
   }
Exemple #21
0
void CubetaHuevosState::draw(){
	ofBackgroundGradient( ofColor(64), ofColor(0),OF_GRADIENT_BAR);
	
	

	glEnable(GL_DEPTH_TEST);

	GLfloat ambient[] = {0.0, 1.0, 0.0, 1.0};
	GLfloat diffuse[] = {1.0, 1.0, 1.0, 1.0};
	GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
	GLfloat position[] = {(float)ofGetWidth()/2, (float)ofGetHeight()/2, 1000, 1.0};

	glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
	glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
	glLightfv(GL_LIGHT0, GL_POSITION, position);

	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);	

	glEnable(GL_LINE_SMOOTH);
	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);

	glEnable(GL_POINT_SMOOTH);
	glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);


	vector<ofPoint>		points ;
	points.clear();
	
	points.push_back(ofPoint(500,500,5));
	points.push_back(ofPoint(200,200,5));
	points.push_back(ofPoint(400,100,5));
	

	float shininess=10;


	ofPoint p;

	
	//ofLog()<<"Lista de puntos";
	for (int j=0;j<100;j++){
		for (int i=0;i<100;i++){
			p.x=-100+i*20;
			p.y=-100+j*20;
			p.z=30*(sin(TWO_PI*(((float)i/10)+delta))+cos(TWO_PI*(((float)j/10+delta))));
			//ofLog()<<"z: "<<p.z;
			
			glPointSize(10*(sin(TWO_PI*(((float)i/10)+delta))+cos(TWO_PI*(((float)j/10+delta)))));
			
			diffuse[0] = 1.0*(p.z/55);
			glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
			glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
			glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
			glLightfv(GL_LIGHT0, GL_POSITION, position);
			glBegin(GL_POINTS);
				glVertex3f(p.x, p.y, p.z);
			glEnd();
		}
	}
	
	//camara.end();


	glDisable(GL_LINE_SMOOTH);
	glDisable(GL_POINT_SMOOTH);
	glDisable(GL_DEPTH_TEST);
	glDisable(GL_LIGHTING);

}
Exemple #22
0
//--------------------------------------------------------------
void testApp::draw(){
    ofBackgroundGradient(ofColor::gray, ofColor(50,10,50),OF_GRADIENT_CIRCULAR);
    
}
Exemple #23
0
void InitialState::draw(){
	cam.update();

	if(cam.isFrameNew()){
		fboCam.begin();
			cam.draw(0, 0);
		fboCam.end();
	}

	ofBackgroundGradient(ofColor(64), ofColor(0), OF_GRADIENT_BAR);
	
	if(exerciseIndex == 0){
		fboGrayscale.begin();
			shaderGrayscale.begin();
				shaderGrayscale.setUniformTexture("tex", cam.getTextureReference(), 0);
				shaderGrayscale.setUniform1f("rWeight", rWeight);
				shaderGrayscale.setUniform1f("gWeight", gWeight);
				shaderGrayscale.setUniform1f("bWeight", bWeight);
				shaderGrayscale.setUniform1f("power", power);			

				ofRect(0, 0, fboGrayscale.getWidth(), fboGrayscale.getHeight());
			shaderGrayscale.end();
		fboGrayscale.end();

		fboGrayscale.draw(0, 0);
	} else if(exerciseIndex == 1){
		fboRunningAverage.begin();
			shaderRunningAverage.begin();
				shaderRunningAverage.setUniformTexture("tex", cam.getTextureReference(), 0);
				shaderRunningAverage.setUniformTexture("lastTex", fboLast.getTextureReference(), 1);
				shaderRunningAverage.setUniform1f("factor", runningAverageFactor);

				ofRect(0, 0, fboRunningAverage.getWidth(), fboRunningAverage.getHeight());
			shaderGrayscale.end();
		fboRunningAverage.end();

		fboRunningAverage.draw(0, 0);

		fboLast.begin();
			fboRunningAverage.draw(0, 0, fboLast.getWidth(), fboLast.getHeight());
		fboLast.end();
	} else if(exerciseIndex == 2){
		fboMotionDiff.begin();
			shaderMotionDiff.begin();
				shaderMotionDiff.setUniformTexture("tex", fboCam.getTextureReference(), 0);
				shaderMotionDiff.setUniformTexture("lastTex", fboLastCam.getTextureReference(), 1);
				shaderMotionDiff.setUniformTexture("lastOutput", fboLast.getTextureReference(), 2);
				shaderMotionDiff.setUniform1f("factor", motionDiffThreshold);

				static float colorPhase = 0;
				shaderMotionDiff.setUniform1f("colorPhase", colorPhase += 0.01);
				

				ofRect(0, 0, fboMotionDiff.getWidth(), fboMotionDiff.getHeight());
			shaderGrayscale.end();
		fboMotionDiff.end();

		fboMotionDiff.draw(0, 0);

		fboLast.begin();
			fboMotionDiff.draw(0, 0, fboLast.getWidth(), fboLast.getHeight());
		fboLast.end();

		fboLastCam.begin();
			cam.draw(0, 0, fboLastCam.getWidth(), fboLastCam.getHeight());
		fboLastCam.end();
	} else if(exerciseIndex == 3){
		fboCartoonizer.begin();
			shaderCartoonizer.begin();
				shaderCartoonizer.setUniformTexture("tex", cam.getTextureReference(), 0);
				shaderCartoonizer.setUniform1i("cellSize", cellSize);
				shaderCartoonizer.setUniform1i("radius", radius);				
				
				ofRect(0, 0, fboCartoonizer.getWidth(), fboCartoonizer.getHeight());
			shaderGrayscale.end();
		fboCartoonizer.end();

		fboCartoonizer.draw(0, 0);
	} else if(exerciseIndex == 4){
		fboMosaic.begin();
			shaderMosaic.begin();
				shaderMosaic.setUniformTexture("tex", cam.getTextureReference(), 0);
				shaderMosaic.setUniform1f("scale", scale);				
				shaderMosaic.setUniform2f("size", cam.getWidth(), cam.getHeight());				
				
				ofRect(0, 0, fboMosaic.getWidth(), fboMosaic.getHeight());
			shaderMosaic.end();
		fboMosaic.end();

		fboMosaic.draw(0, 0);
	}

	
	
	/*if(showVideo == 1){
		int frame = ofLerp(0, video1.getTotalNumFrames(), ofGetMouseX() / (float)ofGetWidth());
		video1.setFrame(frame);
		video1.play();
		video1.update();
		video1.stop();
		video1.draw(ofGetWidth(), 0, -ofGetWidth(), ofGetHeight());
		ofDrawBitmapString("Frame: " + ofToString(frame), 20, ofGetHeight() - 40);
	} else if(showVideo == 2){
		int frame = ofLerp(0, video2.getTotalNumFrames(), ofGetMouseX() / (float)ofGetWidth());
		video2.setFrame(frame);
		video2.play();
		video2.update();
		video2.stop();
		video2.draw(ofGetWidth(), 0, -ofGetWidth(), ofGetHeight());
		ofDrawBitmapString("Frame: " + ofToString(frame), 20, ofGetHeight() - 40);
	}*/

	if(drawGui)
		gui[exerciseIndex].draw();

	int y = ofGetHeight() - 20;
	for(int i = texts[exerciseIndex].size() - 1; i >= 0; i--, y -= 20){
		ofDrawBitmapString(texts[exerciseIndex][i], 20, y);
	}
}
Exemple #24
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofBackgroundGradient(ofColor(245), ofColor(200));
	//ofSetLineWidth(1);
	
	//The following is just to print the instructions to the screen.
	ofSetColor(80);
	ofDrawBitmapString("Click here to add horizontal oscillators.", LEFT_MARGIN +100, TOP_MARGIN-5 );
	
	ofDrawBitmapString("Click and drag\nover an\noscillator to\nmodify it's\nspeed and\namplitude", 15,25);
	ofDrawBitmapString("Click in this area and drag upwards/downwards to scale up/down.\nPress spacebar to delete all the oscillators.", LEFT_MARGIN + 200, ofGetHeight()-40);
	
	//All this bunch is to print the vertical text
	ofPushMatrix();
	ofTranslate(LEFT_MARGIN -5,  ofGetHeight() - 100, 0);
	ofRotate(-90, 0, 0, 1);
	ofDrawBitmapString("Click here to add vertical oscillators.",  0, 0 );
	ofPopMatrix();
	
	
	
	
	ofEnableSmoothing();
	
	//This are just the reference lines draw in the screen.
	ofSetColor(0, 0, 0, 150);
	ofDrawLine(LEFT_MARGIN, 0, LEFT_MARGIN, ofGetHeight());
	ofDrawLine(0, TOP_MARGIN, ofGetWidth(), TOP_MARGIN);
	
	ofSetColor(0, 0, 0, 80);
	ofDrawLine(LEFT_MARGIN, center.y, ofGetWidth(), center.y);
	ofDrawLine(center.x, TOP_MARGIN, center.x, ofGetHeight());
	
	//ofSetLineWidth(2);
	
	
	float horWave = 0;
	float vertWave = 0;
	
	//here we go through all the horizontal oscillators
	for (unsigned int i=0; i<horizontalOscilators.size(); i++) {
		ofSetColor(255, 127+i, 0,150);
		horizontalOscilators[i].draw(); //we draw each oscillator
		horWave += horizontalOscilators[i].waveSin;
		//THIS IS IMPORTANT. Here we are adding together all the current sine values of each oscillator.
		// This is what is creates all the crazy motion that we get.
	}
	//the same as above but for vertical oscillators
	for (unsigned int i=0; i<verticalOscilators.size(); i++) {
		ofSetColor(0, 127+i, 255, 150);
		verticalOscilators[i].draw();
		vertWave += verticalOscilators[i].waveSin;
	}
	//here we move all the elements of the array one position forward so to make space for a new value.
	for (int i=1; i<TAIL_LENGTH; i++) {
		waveHistory[i-1] = waveHistory[i];
	} 
	for (int i=1; i<WAVEFORM_HISTORY; i++) {
		horWaveHistory[i-1] = horWaveHistory[i];
		vertWaveHistory[i-1]= vertWaveHistory[i];
	}
	// here we save into our history
	horWaveHistory[WAVEFORM_HISTORY-1] = horWave;
	vertWaveHistory[WAVEFORM_HISTORY-1] = vertWave;
	waveHistory[TAIL_LENGTH-1] = ofVec3f(horWave, vertWave,0);
	
	
	
	ofMesh wave; // declaring a new ofMesh object with which we're drawing the motion path created by summing the vertical and horizontal oscillators
	wave.setMode(OF_PRIMITIVE_LINE_STRIP);
	for (int i=0; i<TAIL_LENGTH; i++) {
		wave.addColor(ofFloatColor(0.1f,0.1f,0.1f, 0.5f + 0.5f * i/float(TAIL_LENGTH) ));
		wave.addVertex(waveHistory[i]);
	}
	
	//all the following is to create and populate the horizontal and vertical waveforms.
	ofMesh hWave;
	hWave.setMode(OF_PRIMITIVE_LINE_STRIP);
	ofMesh vWave;
	vWave.setMode(OF_PRIMITIVE_LINE_STRIP);
	for (int i=0; i<WAVEFORM_HISTORY; i++) {
		hWave.addColor(ofFloatColor(255, 240,10, 255));
		hWave.addVertex(ofVec3f(i*hWaveMult, horWaveHistory[i]*0.1f*scale, 0));
		vWave.addColor(ofFloatColor(255, 240,10, 255));
		vWave.addVertex(ofVec3f(vertWaveHistory[i]*0.1f*scale, i*vWaveMult, 0));
	}
	
	//draw the vertical and horizontal wave.
	ofPushMatrix();
	ofTranslate(LEFT_MARGIN, TOP_MARGIN, 0);
	hWave.draw();
	vWave.draw();
	ofPopMatrix();
	
	//draw the composite wave.
	ofPushMatrix();
	ofTranslate(center.x, center.y, 0);
	ofScale(scale, scale, 0);
	wave.draw();
	ofSetColor(0,10, 255),
	ofDrawCircle(horWave, vertWave, 10);
	ofPopMatrix();
	
}
//--------------------------------------------------------------
void testApp::draw(){
	ofBackgroundGradient( ofColor(255), ofColor(180), OF_GRADIENT_CIRCULAR);
	renderSignedNoiseDemo();
	renderNoisyRobotArmDemo();
}
Exemple #26
0
//--------------------------------------------------------------
void testApp::draw() {

    //set background to pretty gray gradient
    ofBackgroundGradient(ofColor::black, ofColor::gray);

    //Update the GUI elements
    guiUpdate();

    ofSetColor(255);  // Set color to white

    //onscreen instructions
    if(camMode) {
        string msg;
        msg += "Instructions:\n";
        msg += "Press up and down arrow keys to adjust contour contrast level\n";
        msg += "Press the space bar to reset the background\n";
        myFont.drawString(msg, 210, 20);
    }
    else if (ILDAmode) {
        string msg;
        msg += "Instructions:\n";
        msg += "Press \"n\" or right arrow to go to next file, \"b\" or left arrow to go to previous file\n";
        msg += "Toggle \"Draw ILDA\" off to make the framerate faster\n";
        msg += "ILDA files are in \"data/ildaFiles\"";
        myFont.drawString(msg, 210, 20);
    }
    else if (manualControl) {
        string msg;
        msg += "Instructions:\n";
        msg += "Turn laser on and off with \"Laser\" toggle\n";
        msg += "Click and drag within 2D pad to control laser point\n";
        myFont.drawString(msg, 210, 20);
    }
    else {
        string msg;
        msg += "Instructions:\n";
        msg += "Click on the \"Serial Devices\" dropdown to select your serial comm port\n";
        msg += "To rescan serial ports, click refresh\n";
        myFont.drawString(msg, 210, 20);
    }

    /* -------- DRAW CURRENT ILDA GRAPHIC ----------- */
    if(ILDAmode && drawILDA && fileLoaded && !manualControl && !camMode ) {

        ofSetLineWidth(1);

        // Draw the current idla file in the center of the CUI
        for(int i = 0; i < (nPts-1); i++) {

            // Draw circle around "Point" currently selected in point inspector
            if(point == (i+1)) {
                ofSetColor(0,255,255);
                ofNoFill(); //draw circle outline, thus nofill
                ofCircle(gui_ctr.x+x_grd[i],gui_ctr.y-y_grd[i],10);
            }

            // If laser if on, draw red line, otherwise white line
            if(l_state[i]) {
                ofSetColor(153,0,0);
                ofLine(gui_ctr.x+x_grd[i],gui_ctr.y-y_grd[i], \
                       gui_ctr.x+x_grd[i+1],gui_ctr.y-y_grd[i+1]);
            }
            else if(!l_state[i]) {
                ofSetColor(150,150,150);
                ofLine(gui_ctr.x+x_grd[i],gui_ctr.y-y_grd[i], \
                       gui_ctr.x+x_grd[i+1],gui_ctr.y-y_grd[i+1]);
            }
        }

    }

    /* ------- DRAW MANUAL POINT POSITION ----------- */
    if(manualControl) {

        ofPushStyle();
        ofEnableBlendMode(OF_BLENDMODE_ALPHA);

        //draw laser cursor on screen
        ofSetColor(255, 100, 100, 150);
        ofFill();
        ofCircle(positionDraw.x,positionDraw.y, radius);
        ofPopStyle();
    }

    /* --------- DRAW EDGE CONTOUR -------------------- */
    if(camMode) {

        // Set coordinate for CV video feed
        int x_max = 320;
        int y_max = 240;
        int xCam_ctr = gui_ctr.x - (x_max/2);
        int yCam_ctr = gui_ctr.y;

        // Draw Color Image, All blob contours
        colorImg.draw(xCam_ctr,(yCam_ctr-1.15*y_max));
        contourFinder.draw(xCam_ctr - 0.6*x_max,yCam_ctr);

        //label webcam images
        myFont.drawString("Webcam Image", xCam_ctr+110, yCam_ctr-1.15*y_max-5 );
        myFont.drawString("Blobs", xCam_ctr - 0.6*x_max + 135, yCam_ctr - 5 );
        myFont.drawString("Contours", xCam_ctr + 0.6*x_max + 125, yCam_ctr -5 );

        // Draw first blob
        if(contourFinder.nBlobs) {

            if(multiContours) {
                //draw multiple blobs
                // Iterate through each blob
                for(int i = 0; i < contourFinder.nBlobs; i++) {

                    int edg_pts = contourFinder.blobs[i].nPts;  // Number of points in contour

                    // Iterate through each point in each blob
                    for(int j = 0; j < (edg_pts-1); j++) {
                        // Draw contour lines
                        ofLine( xCam_ctr + 0.6*x_max + contourFinder.blobs[i].pts[j].x,     \
                                yCam_ctr + contourFinder.blobs[i].pts[j].y,    \
                                xCam_ctr + 0.6*x_max + contourFinder.blobs[i].pts[j+1].x,  \
                                yCam_ctr + contourFinder.blobs[i].pts[j+1].y);      // Draw connecting lines
                    }

                }

                // Draw border lines
                ofLine( xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + 0,      \
                        xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + 0);

                ofLine( xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + 0,      \
                        xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + y_max);

                ofLine( xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + y_max,    \
                        xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + y_max);

                ofLine( xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + y_max,    \
                        xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + 0);
            }
            else {
                //draw only the first blob
                int n = contourFinder.blobs[0].nPts;
                for(int i = 0; i < (n-1); i++) {

                    // Draw contour lines
                    ofLine( xCam_ctr + 0.6*x_max + contourFinder.blobs[0].pts[i].x,     \
                            yCam_ctr + contourFinder.blobs[0].pts[i].y,    \
                            xCam_ctr + 0.6*x_max + contourFinder.blobs[0].pts[i+1].x,  \
                            yCam_ctr + contourFinder.blobs[0].pts[i+1].y);      // Draw connecting lines
                }

                // Draw border lines
                ofLine( xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + 0,      \
                        xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + 0);

                ofLine( xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + 0,      \
                        xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + y_max);

                ofLine( xCam_ctr + 0.6*x_max + x_max,    \
                        yCam_ctr + y_max,    \
                        xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + y_max);

                ofLine( xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + y_max,    \
                        xCam_ctr + 0.6*x_max + 0,      \
                        yCam_ctr + 0);
            }

        }
    }
}
Exemple #27
0
//--------------------------------------------------------------
void testApp::drawFboTest(){
	//we clear the fbo if c is pressed.
	//this completely clears the buffer so you won't see any trails
	if( ofGetKeyPressed('0') ){
		ofClear(255,255,255, 0);
	}
    
    //1 - Fade Fbo
	
	//this is where we fade the fbo
	//by drawing a rectangle the size of the fbo with a small alpha value, we can slowly fade the current contents of the fbo.
  
    ofFill();
  
    ofColor dark(10,fadeAmnt);
    ofColor black(0, fadeAmnt);
    ofBackgroundGradient(dark, black);

     if(number== 1) {
         fadeAmnt = 100;
     }
    
     if(number== 2) {
         fadeAmnt = 60;
      }

    if(number== 3) {
        fadeAmnt = 30;
    }
    
    if(number== 4) {
        fadeAmnt = 5;
        
    }
    
    if(number== 5) {
        fadeAmnt = 10;
        
    }
    
    
    if(number== 6) {
        fadeAmnt = 20;
        
    }
    
    if(number== 7) {
        fadeAmnt = 0;
        
    }
    
    if(number== 8) {
        fadeAmnt = 20;
        
    }
    
    if(number== 9) {
        fadeAmnt = 20;
        
    }
    
    if(number== 10) {
        fadeAmnt = 5;
        
    }
    
    if(number== 12) {
        fadeAmnt = 100;
        
    }
    
    
      
    //	ofRect(0,0,ofGetScreenWidth(),ofGetScreenHeight());
    
	//2 - Draw graphics

	for (int i = 0; i < bgParti.size(); i++){
		bgParti[i]->draw();
	}
    
    
    for (int i = 0; i < dwgParti.size(); i++){

		dwgParti[i].draw();
	   
    }

 
}
//--------------------------------------------------------------
void ofApp::draw(){
    
    //_____________________________________________________________________START STEP
    
    //ofTriangle(50,10,10,40,mouseX,mouseY);
    
    if(game_state == "title"){
        
        
        //Draw Butterfly Symbol (1px, staticBG)
        
       ofBackgroundGradient(ofColor::pink,ofColor::seaShell);

       // ofSetBackgroundAuto(true);
        ofSetLineWidth(1);
        ofSetColor(76,34,98);
        ofNoFill();
        
        ofPushMatrix();
        
        float angle = ofGetElapsedTimef();
       // ofRotate(angle);
        
        ofTriangle(ofGetWidth()/2,ofGetWindowHeight()/2,(ofGetWidth()/2)-mouseX, (ofGetWindowHeight()/2)+mouseX,(ofGetWidth()/2)-mouseX, (ofGetWindowHeight()/2)-mouseX);
        ofTriangle(ofGetWidth()/2,ofGetWindowHeight()/2,(ofGetWidth()/2)+mouseX, (ofGetWindowHeight()/2)+mouseX,(ofGetWidth()/2)+mouseX, (ofGetWindowHeight()/2)-mouseX);
        
        ofPopMatrix();
        
    
        
        
        
        
    }
    
    if(game_state == "start"){
        
        
      //  ofEnableBlendMode(OF_BLENDMODE_SUBTRACT);
        
      //  ofBackgroundGradient(ofColor::pink,ofColor::seaShell);
        screenGrab.draw(ofGetScreenWidth()/2,ofGetScreenHeight()/2);
       
        
        
        
        
        
        
        
        
     //   ofSetColor((int)ofRandom(0,mouseX),(int)ofRandom(0,mouseY),(int)ofRandom(0,255),255*lerpValue);
        
        for(int i = 0; i < splatLimit; i++){
            ofSetColor((int)ofRandom(25,255),(int)ofRandom(78,255),(int)ofRandom(128,255),128);
            paint1.draw(ofRandom(-500,500),ofRandom(-500,500));
            paint2.draw(ofRandom(0,1000),ofRandom(0,1000));
            
            
            
        }
        
        
        screenGrab.draw(ofGetScreenWidth()/2,ofGetScreenHeight()/2);
        
        ofSetColor((int)ofRandom(0,mouseX),(int)ofRandom(0,mouseY),(int)ofRandom(0,255),25);
        
        ofScale(0.9*ofGetScreenWidth() ,0.9*ofGetScreenHeight());
        ofRect(0, 0, lerpValue*2000, lerpValue*700);
        ofRect(100, 0, lerpValue*2000, lerpValue*700);
        ofRect(200, 0, lerpValue*2000, lerpValue*700);
        ofRect(300, 0, lerpValue*2000, lerpValue*700);
        ofRect(400, 0, lerpValue*2000, lerpValue*700);
        ofRect(500, 0, lerpValue*2000, lerpValue*700);
        ofRect(600, 0, lerpValue*2000, lerpValue*700);
        
        
       
        
    }
    
    
    //_____________________________________________________________________STEP 1
    
    else if (game_state == "step1"){
        
      //  ofBackgroundGradient(ofColor::pink,ofColor::seaShell);
        
        //ofRect(0, 0, 0, 200, 200);
       ofSetColor((int)ofRandom(0,255),(int)ofRandom(0,255),(int)ofRandom(0,255));
        //screenGrab.resize(0.9 * screenGrab.width, 0.9 *screenGrab.height);
        screenGrab.draw(mouseX,mouseY);
        //screenGrab.setCompression(OF_COMPRESS_SRGB);
        
        
    }
    
    
    //_____________________________________________________________________STEP 2
    
    else if (game_state == "step2"){
        
        //ofBackgroundGradient(ofColor::pink,ofColor::seaShell);
       
        ofSetColor((int)ofRandom(0,mouseX),(int)ofRandom(0,mouseY),(int)ofRandom(0,255),25);
        
        screenGrab.draw(mouseX-512,mouseY-512);
        
        ofRect(0, 0, lerpValue*2000, lerpValue*700);
        ofRect(0, 100, lerpValue*2000, lerpValue*700);
        ofRect(0, 200, lerpValue*2000, lerpValue*700);
        ofRect(0, 300, lerpValue*2000, lerpValue*700);
        ofRect(0, 400, lerpValue*2000, lerpValue*700);
        ofRect(0, 500, lerpValue*2000, lerpValue*700);
        ofRect(0, 600, lerpValue*2000, lerpValue*700);

       
        
        
        
    }

    
    
}
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(ofColor::gray, ofColor(30,10,30), OF_GRADIENT_CIRCULAR);
    theBall.draw();
}
Exemple #30
0
void ofApp::draw()
{
    ofBackgroundGradient(ofColor::white, ofColor::black);

    ofDrawBitmapStringHighlight("See console for output.", ofPoint(30, 30));
}