Exemplo n.º 1
0
//--------------------------------------------------------------
void ofApp::draw()
{
    int strwdth = myfont.stringWidth(searchCriteria);
    gifPlayer.draw(0, 0, screenWidth, screenHeight);
    ofSetColor(44, 44, 44);
    ofDrawPlane(100+(strwdth/2), 90, strwdth+40, myfont.stringHeight(searchCriteria)+20);
    ofSetColor(255, 255, 255);
    myfont.drawString(searchCriteria, 100, 100);
    
    
}
//--------------------------------------------------------------
void testApp::draw(){	
	ofBackgroundGradient(ofColor(0,255,0),ofColor(0,0,255),OF_GRADIENT_LINEAR);
	
	glEnable(GL_BLEND);
	text.bind();
	glBlendFunc( BLENDS[currentLBlend], BLENDS[currentRBlend] );
		
    for (int i = 0; i < numPlanes; i++) {
		ofPushMatrix();
		ofTranslate(planePos[i].x,planePos[i].y,200.0f);        
		ofDrawPlane(100,100);
		ofPopMatrix();
    }

    glDisable(GL_BLEND);
	text.unbind();
	glDisable(GL_BLEND);

	ofColor(255);
	font.drawString("Blending Mode: SRC:"+BLEND_MODE[currentLBlend] + ", DST:"+BLEND_MODE[currentRBlend], 30, 35);
}
Exemplo n.º 3
0
void ofxTouchBoard::drawGraphBar(float x0, float y0, int i, float val, float width, float xOffset){
	float y = y0 - (val * graphHeight)/2.0;
	float x = x0 + graphBarWidth + xOffset + (graphBarWidth + graphBarSpace) * i;
	ofDrawPlane(x, y, width, val * graphHeight);
}
//--------------------------------------------------------------
void ofApp::drawScene()
{
	ofEnableDepthTest();
		
		// Draw the floor
		ofSetColor(20, 20, 20);
		ofPushMatrix();
			ofRotate(90,	1, 0, 0);
			ofDrawPlane( 1600.0f, 1600.0f );
		ofPopMatrix();

		ofDisableDepthTest();
		ofSetColor(40, 40, 40);
		ofPushMatrix();
			ofRotate(90,	0, 0, -1);
			ofDrawGridPlane(800.0f, 10.0f, false );
		ofPopMatrix();
		ofEnableDepthTest();
	
		//ofDrawPlane( 1000.0f, 1000.0f );

		ofSetColor( ofColor::white );
		linesMesh.draw();
		
		// Draw the spheres
		for(int i = 0; i < demos.size(); i++)
		{
			ofPushMatrix();
				ofTranslate(demos[i].pos);
				ofSetColor(demos[i].isMouseOvered ? ofColor::white.getLerped(ofColor::red, sin(ofGetElapsedTimef()*10.0)*.5+.5) : demos[i].color); // pulse red to white when it's 'mouseovered'
				//ofSetColor(demos[i].color);
				ofSphere(demos[i].radius);
				//ofSphere(demos[i].isMouseOvered ? demos[i].radius * 10.0f: demos[i].radius ); // draw the sphere larger when it's 'mouseovered'
			ofPopMatrix();
		}
		
		// Draw the text and an indicator for the distance form the mouse we are using to reveal or hide the sculpture
	
		ofSetColor( ofColor::white );
		meshFont.drawStringAsShapes("Lines Max Connection Distance: " + ofToString(lineConnectionMaxDistance, 1), -450, 170 );
		ofPushMatrix();
			ofTranslate( ofVec3f(-450, 150, 0 ) );
			ofNoFill();
				ofRect( 0,0, 250, 10 );
			ofFill();
				ofRect( 0,0, 250 * ofMap( lineConnectionMaxDistance, lineConnectionMaxDistanceMin, lineConnectionMaxDistanceMax, 0.0f, 1.0f), 10 );
		ofPopMatrix();
	
		meshFont.drawStringAsShapes("Mouse Affection Radius: " + ofToString(mouseAffectionRadius, 1), -450, 130 );
	
	
		ofNoFill();
		// Billboard and draw the mouse
		if(oculusRift.isSetup())
		{
			ofPushMatrix();
				ofSetColor(255, 0, 0);
				oculusRift.multBillboardMatrix();
				ofCircle(0,0,.5);
			ofPopMatrix();
		}
		
		ofSetColor( ofColor::white );
		ofFill();
	
	ofDisableDepthTest();
	
}