コード例 #1
0
ファイル: testApp.cpp プロジェクト: damiannz/openFrameworks
//--------------------------------------------------------------
void testApp::render1DNoiseStrip (float x, float y, float width, float height, float dt, float *data){
	
	float now = ofGetElapsedTimef();
	ofPushMatrix();
	ofDisableSmoothing();
	ofEnableAlphaBlending();
	ofTranslate(x, y, 0); 
	
	// Yes, this is a drop shadow
	ofFill();
	ofSetColor(0,0,0, 10); 
	ofRect(0,0, width+4, height+2);
	ofRect(0,0, width+2, height+4); 
	
	// Draw a white box underneath the strip
	ofFill();
	ofSetColor(255,255,255); 
	ofRect(0,0, width, height); 
	
	// Draw a filled gray noise terrain.
	ofEnableSmoothing();
	ofFill();
	ofSetColor(190); 
	ofBeginShape();
	ofVertex(width, height);
	for (int i=0; i<NOISE_DATA_STRIP_LENGTH; i++){
		float px = ofMap(i, 0,(NOISE_DATA_STRIP_LENGTH-1), width,0); 
		float py = height * data[i];
		ofVertex(px,py);
	}
	ofVertex(0, height); 
	ofEndShape(true);
	
	// Draw the black line of the noise waveform
	ofNoFill();
	ofSetColor(0,0,0); 
	ofBeginShape();	
	for (int i=0; i<NOISE_DATA_STRIP_LENGTH; i++){
		float px = ofMap(i, 0,(NOISE_DATA_STRIP_LENGTH-1), width,0); 
		float py = height * data[i];
		ofVertex(px,py);
	}
	ofEndShape(false);
	
	// Draw a box outline on top, around everything
	ofDisableSmoothing();
	ofNoFill();
	ofSetColor(0,0,0); 
	ofRect(0,0, width, height);
	
	// Draw the dt noise-step factor
	if (dt > 0){
		ofSetColor(0,0,0); 
		string label = ofToString(dt);
		ofDrawBitmapString(label, -46, height/2+6);
	}

	ofPopMatrix();
}
コード例 #2
0
ファイル: turtle.cpp プロジェクト: scimusmn/Animation-Lab
void ofTurtle::draw(int _x, int _y)
{
  int ppi=pixPerInch;
  ofPoint wheel(.25*ppi,(2+3/8)*ppi);
  ofPoint rWheel(1.125*ppi,1.875*ppi);
  ofRectangle body(-3.25*ppi/2,-wheel.y/2,ppi*3.25,ppi*4.5);
  //int body=w-whlWid*2;
  //int leng=h;
  ofEnableSmoothing();
  for (unsigned int i=0; i<lines.size()-1&&lines.size()>1; i++) {
    ofSetLineWidth(2);
    ofLine(lines[i].x, lines[i].y, lines[i+1].x, lines[i+1].y);
  }
  ofDisableSmoothing();
  ofPushMatrix();
  ofTranslate(pos.x, pos.y, 0);
  ofRotate(360-bearing.absoluteAngle());
  
  ofEnableSmoothing();
  ofSetColor(black.opacity(128));
  ofRect(body.x,body.y,body.width,body.height);
  ofSetColor(white);
  ofNoFill();
  ofRect(body.x,body.y,body.width,body.height);
  ofFill();
  ofSetColor(black);
  ofRect(body.x-ppi*3/8, body.y, wheel.x, wheel.y);
  ofRect(body.x+body.width+ppi*3/32, body.y, wheel.x, wheel.y);
  /*ofSetColor(white*.8);
  ofRect(body.x+(body.width-ppi*1.375)/2, body.y+body.height, 1.375*ppi, .25*ppi);
  ofRect(body.x+(body.width-ppi*1.375)/2+1.125*ppi, body.y+body.height, .25*ppi,1.375*ppi);
  ofSetColor(white*.5);
  ofRect(body.x+(body.width-ppi*1.375)/2+.125*ppi, body.y+body.height+.5*ppi, .875*ppi, 1.5*ppi);
  ofSetColor(orange);
  ofRect(body.x+(body.width-ppi*1.375)/2+.125*ppi, body.y+body.height+.50625*ppi, .375*ppi, .4375*ppi);
  ofRect(body.x+(body.width-ppi*1.375)/2+.125*ppi, body.y+body.height+(2.-.4375)*ppi, .375*ppi, .4375*ppi);
  ofRect(body.x+(body.width-ppi*1.375)/2+(1-.375)*ppi, body.y+body.height+(.5+(1.5-.4375)/2)*ppi, .375*ppi, .4375*ppi);*/
  ofPopMatrix();
  ofDisableSmoothing();
  
  if(!frontIsClear(frontCheckDist)) ofSetColor(255, 0, 0);
  else ofSetColor(0, 255, 0);
  ofPoint ps = pointAlongBearing(frontCheckDist+wheel.y/2);
  ofCircle(ps.x, ps.y, 5);
  
  if(!leftIsClear(leftCheckDist)) ofSetColor(255, 0, 0);
  else ofSetColor(0, 255, 0);
  ps = pos+bearing.ortho().unit()*w/2-bearing.unit()*w/2+bearing.unit().rotate(270)*leftCheckDist;
  ofCircle(ps.x, ps.y, 5);
  
  for (unsigned int i=0; i<bdy.size(); i++) {
    ofSetColor(yellow);
    ofVector t=bdy[i];
    ofLine(pos, pos+t.rotate(360-bearing.absoluteAngle()));
  }
}
コード例 #3
0
ファイル: testApp.cpp プロジェクト: MrMdR/julapy
void testApp :: drawSpeachBubbles ()
{
	for( int i=0; i<bubbles.size(); i++ )
	{
		SpeachBubble& bubble = bubbles[ i ];

		//-- black outline.
		
		ofSetColor( 0x000000 );
		ofSetLineWidth( 3 );
		
		ofNoFill();
		ofEnableSmoothing();
		
		bubble.drawBubble();
		bubble.drawPoint();
		
		ofDisableSmoothing();
		
		//-- white fill.
		
		ofFill();
		ofSetColor( 0xFFFFFF );
		
		bubble.drawBubble();
		bubble.drawPoint();

		//-- white smaller border.
		
		ofSetColor( 0xFFFFFF );
		ofSetLineWidth( 1 );
		
		ofNoFill();
		ofEnableSmoothing();
		
		bubble.drawBubble();
		bubble.drawPoint();
		
		ofDisableSmoothing();
		
		//-- text.
		
		ofSetColor( 0x000000 );
		ofSetLineWidth( 1 );
		
		ofFill();
		bubble.drawText();
	}
}
コード例 #4
0
ファイル: splashNav.cpp プロジェクト: EDesignLabs/Breadcrumbs
//------------------------------------------------------------------
void splashNav::draw() {
    
        ofBackground(0, 0, 0);
    
        ofEnableAlphaBlending();

        
        ofSetColor(190, 190, 190, 255);
    
        layerOne->draw(splashPageOne.pos.x, splashPageOne.pos.y);
        layerTwoA->draw(splashPageTwo.pos.x, splashPageTwo.pos.y);
        layerTwoB->draw(locationB.x, locationB.y);
        layerTwoC->draw(locationC.x, locationC.y);
        layerTwoD->draw(locationD.x, locationD.y);
        layerTwoE->draw(locationE.x, locationE.y);
        layerTwoF->draw(locationF.x, locationF.y);
    
        ofEnableSmoothing();
        ofNoFill();
        ofCircle(storyZeroActive->x, storyZeroActive->y, 8.0);
        ofCircle(storyOneActive->x, storyOneActive->y, 8.0);
        ofCircle(storyTwoActive->x, storyTwoActive->y, 8.0);
        ofCircle(storyThreeActive->x, storyThreeActive->y, 8.0);
        ofCircle(storyFourActive->x, storyFourActive->y, 8.0);
        ofCircle(storyFiveActive->x, storyFiveActive->y, 8.0);
        ofFill();
        ofCircle(storyAction->x, storyAction->y, 8.0);
        ofDisableSmoothing();
    
        
    
        ofDisableAlphaBlending();
}
コード例 #5
0
ファイル: Subdivide.cpp プロジェクト: decebel/OF-tools
void Subdivision::draw(DrawStrategy drawStrategy)
{
    update();
    
    ofSetCircleResolution(*circleResolution);
    ofEnableSmoothing();
    
    if (generation == 0)
    {
        if (drawStrategy == RECTS) {
            drawRect();
        }
        else if (drawStrategy == DIAMONDS) {
            drawDiamond();
        }
        else if (drawStrategy == CIRCLES) {
            drawCircle();
        }
    }
    else
    {
        child1->draw(drawStrategy);
        child2->draw(drawStrategy);
    }
    
    ofDisableSmoothing();
}
コード例 #6
0
ファイル: Boid.cpp プロジェクト: bruzed/electric-clouds
void Boid::draw() {
	ofEnableSmoothing();
	ofEnableAlphaBlending();
	//ofSetColor(255, 0, 0, 100);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	glPushMatrix();
	glTranslatef(pos.x, pos.y, pos.z);
		img.draw(0, 0, 200, 200);
	glPopMatrix();
	
	//ofSetLineWidth(3);

	float arrow_len = 30;
	ofxVec3f arrow_end = pos +(vel.normalized() * arrow_len);
	//ofFill();
	//ofEnableSmoothing();
	ofLine(pos.x, pos.y, arrow_end.x, arrow_end.y);
	ofCircle(arrow_end.x, arrow_end.y, 3);

	ofCircle(pos.x, pos.y, 10);

	//ofSetLineWidth(20);
	//ofCircle(pos.x, pos.y, 10);

	//ofSetColor(0x00);
	//ofSetLineWidth(3);
	//ofCircle(pos.x, pos.y, 12);


	glDisable(GL_BLEND);
	ofDisableAlphaBlending();
	ofDisableSmoothing();

}
コード例 #7
0
ファイル: testApp.cpp プロジェクト: ptterb/PrintingCode
//--------------------------------------------------------------
void testApp::keyPressed(int key){
    
    
    if (key == 101){            // if 'e' pressed, export points
        
        for (int i = 0; i < points.size(); i++){
            ofLogNotice() << points.at(i);
        }
        
    } else if (key == 99){      // 'c' to generate new colors
        generateColors();
    } else if (key == 357) {    // 'up' to move hue clockwise
        myHue++;
        ofLogNotice() << myHue;
        generateColors();
    } else if (key == 359) {    // 'down' to move hue counterclockwise
        myHue--;
        ofLogNotice() << myHue;
        generateColors();
    } else if ( key == 97){     // 'a' to check smoothing disabled
        ofDisableSmoothing();
    } else if (key == 115){     // 's' save pdf
        saveScreen = true;
    } else {
        ofLogNotice() << key;
    }

}
コード例 #8
0
void SingleBrush::selfSetup(){
    ofSetCircleResolution(36);
    ofEnableAlphaBlending();
    ofDisableSmoothing();

    ofSetFullscreen(true);
    
    video.initGrabber(640, 480);
    
    colorAddShader.loadFrag(getDataPath()+"shaders/colorAdd.frag");
    noiseShader.loadFrag(getDataPath()+"shaders/noise.frag");
    absorveShader.loadFrag(getDataPath()+"shaders/absorve.frag");
    displaceShader.loadFrag(getDataPath()+"shaders/displace.frag");
    edge.loadFrag(getDataPath()+"shaders/edge.frag");
    
    ofDisableArbTex();
    ofLoadImage(brushTexture, getDataPath()+"brush.png");
    ofEnableArbTex();
    
    int width = ofGetScreenWidth();
    int height = ofGetScreenHeight();
    colorAdded.allocate(width,height);
    water.allocate(width, height,GL_RGB);
    flow.allocate(width, height);
    noise.allocate(width,height);
    canvas.allocate(width, height);
    edgeFbo.allocate(640, 480);
    
    bColorSample = true;
    
    color.set(0);
}
コード例 #9
0
void boid::draw() {
	ofEnableSmoothing();
	glPushMatrix();
	glTranslatef(pos.x, pos.y, pos.z);
	
	glPopMatrix();
	ofSetLineWidth(2);

	
	ofSetColor(red,green,blue,100);
	//
	
	ofCircle(pos.x,pos.y, radius);
	ofFill();
	
	ofEnableSmoothing();
	
	ofSetColor(red,green,blue,100);
	ofSetLineWidth(3);
	
	//ofCircle(pos.x, pos.y, 6*pos.z*0.015);
	ofCircle(pos.x, pos.y,radius);
	ofDisableSmoothing();
	
}
コード例 #10
0
ファイル: ofApp.cpp プロジェクト: hiroMTB/ob_Android
void ofApp::setup(){
    ofSetFrameRate(target_fps);
    ofSetVerticalSync(true);
    //ofSetWindowShape(1920, 1080);
    ofSetWindowPosition(0, 0);
    ofEnableAlphaBlending();
    ofDisableAntiAliasing();
    ofDisableSmoothing();

    ofSetOrientation( OF_ORIENTATION_DEFAULT );


    bStart = true;
    bLog = true;

    // sound
    int nCh = 1;
    int sampleRate = 48000;
    int bufferSizeTry = bufferSize = 2048;
    currentSamplePos = 0;
    prevSamplePos = 0;

    sound_stream.setup(this, 0, nCh, sampleRate, bufferSizeTry, 4);

    // visual
    int w = ofGetWindowWidth();
    int h = ofGetWindowHeight();
    bHandy = w<h;

    float longside = bHandy ? h:w;
    float shortside = bHandy ? w:h;
    canvas.set(0, 0, longside, shortside);

    track_len = longside * 0.9f;
    track_offset = longside * 0.05;
    start_point.x = track_offset;
    start_point.y = shortside/2;
    indicator.set(0, 0);

    bNeedSaveImg = false;
    ofSetLogLevel(OF_LOG_VERBOSE);

#ifdef USE_GRABBER
    // video
    grbW = 360;
    grbH = 240;
    grabber.listDevices();
    grabber.setDeviceID(1);
    grabber.setUseTexture(false);
    grabber.setPixelFormat( OF_PIXELS_RGB );
    grabber.setDesiredFrameRate( target_fps );
    grabber.setPixelFormat(OF_PIXELS_MONO);
    grabber.setup( grbW, grbH );

    colorImg.allocate( grbW, grbH );
    grayImg.allocate( grbW, grbH );
#endif
}
コード例 #11
0
//----------------------------------------------------
void ofxSimpleSlider::draw(ofEventArgs& event){
	
	ofPushStyle();
	ofEnableAlphaBlending();
	ofDisableSmoothing();
	ofPushMatrix();
	ofTranslate(x,y,0);
	
	// Use different alphas if we're actively maniupulating me. 
	float sliderAlpha = (bHasFocus) ? 128:64;
	float spineAlpha  = (bHasFocus) ? 192:128;
	float thumbAlpha  = (bHasFocus) ? 255:160;
	
	// draw box outline
	ofNoFill();
	ofSetLineWidth(1.0);
	ofSetColor(64,64,64, sliderAlpha); 
	ofRect(0,0, width,height); 
	
	// draw spine
	ofSetLineWidth(1.0);
	ofSetColor(0,0,0, spineAlpha); 
	if (bVertical){
		ofLine(width/2,0, width/2,height); 
	} else {
		ofLine(0,height/2, width,height/2); 
	}
	
	// draw thumb
	ofSetLineWidth(5.0);
	ofSetColor(0,0,0, thumbAlpha);
	if (bVertical){
		float thumbY = ofMap(percent, 0,1, height,0, true);
		ofLine(0,thumbY, width,thumbY); 
	} else {
		float thumbX = ofMap(percent, 0,1, 0,width, true);
		ofLine(thumbX,0, thumbX,height); 
	}
	
	// draw numeric value 
	if (bHasFocus){
		ofSetColor(0); 
	} else {
		ofSetColor(128); 
	}
	if (bVertical){
		ofDrawBitmapString( ofToString(getValue(),numberDisplayPrecision), width+5,height);
	} else {
		ofDrawBitmapString( ofToString(getValue(),numberDisplayPrecision), width+5,height/2 + 4);
		//DRAW ABOVE USE TYPE
		float labelStringWidth = labelString.size();
		//ofDrawBitmapString( labelString, 0-labelStringWidth*8-5, height/2 + 4); 
		ofDrawBitmapString(labelString, 0 , height+10);
	}	

	ofPopMatrix();
	ofPopStyle();
}
コード例 #12
0
ファイル: ofApp.cpp プロジェクト: hiroMTB/dt_
void ofApp::setupVisual(){
	cout << "setting up Visual" << endl;

	ofSetFrameRate(60);
	ofSetVerticalSync(true);
	ofSetCircleResolution(10);
	ofDisableAlphaBlending();
	ofEnableAntiAliasing();
	ofDisableSmoothing();
}
コード例 #13
0
ファイル: Peg.cpp プロジェクト: joelanman/project01
void Peg::draw(){
    
    if(!isBody()) return;
	
	ofPushMatrix();
	ofTranslate(getPosition().x, getPosition().y, 0);
	ofRotate(getRotation(), 0, 0, 1);
	//ofCircle(0, 0, getRadius());
    
    ofNoFill();
    ofEnableSmoothing();
    ofSetLineWidth(2);
    ofCircle(0, 0, getRadius());
    ofDisableSmoothing();
    ofFill();
	
    ofPushStyle();
    ofEnableAlphaBlending();
    
    
    
    if(hl_alpha > 0){
        ofSetColor(highlight_color, hl_alpha);
        ofCircle(0, 0, getRadius());
        
        ofNoFill();
        ofEnableSmoothing();
        ofCircle(0, 0, getRadius()+(255-hl_alpha)/2);
        ofDisableSmoothing();
        ofFill();
        hl_alpha-=5;
    }

    if(isSleeping()) {
        ofSetColor(255, 100);
        ofCircle(0, 0, getRadius());
    }
    ofPopStyle();
    

    ofPopMatrix();

}
コード例 #14
0
//----------------------------------------------------------
//Resets openGL parameters back to OF defaults
void ofGLRenderer::setupGraphicDefaults(){

	glEnableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_NORMAL_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);

	ofDisableSmoothing();
	ofEnableAlphaBlending();
	background(200, 200, 200);
}
コード例 #15
0
ファイル: Blobs02.cpp プロジェクト: MrMdR/julapy
void Blobs02 :: drawBox2d ()
{
	ofSetColor( 255, 255, 255 );
	
	ofFill();				// fill
	drawBlobs();
	
	ofEnableSmoothing();	// lines smoothed.
	ofNoFill();
	drawBlobs();
	ofDisableSmoothing();
	
	for( int i=0; i<blobs.size(); i++ )
	{
		if( bDrawNodes )
		{
			for( int j=0; j<blobs[ i ].nodes.size(); j++)
			{
				blobs[ i ].nodes[ j ].draw();
			}
		}
		
		if( bDrawJoints )
		{
			for( int j=0; j<blobs[ i ].nodeJoints.size(); j++)
			{
				blobs[ i ].nodeJoints[ j ].draw();
			}
		}
	}
	
	ofSetColor( 30, 30, 30 );
	
	ofFill();				// ball fill
	drawBalls();
	
	ofEnableSmoothing();	// ball lines smoothed.
	ofNoFill();
	drawBalls();
	ofDisableSmoothing();
}
コード例 #16
0
ファイル: FFTColor.cpp プロジェクト: bimyoo/AudioVisualApps
void FFTColor::draw(){

	for (int i = 0; i < fft_size/3; i++) {
        magnitudeLow += powf(((testApp*)ofGetAppPtr())->magnitude[i], 0.25);
	}
    for (int i = fft_size/3; i < fft_size/3 * 2; i++) {
        magnitudeMid += powf(((testApp*)ofGetAppPtr())->magnitude[i], 0.25);
    }
    for (int i = fft_size/3 * 2; i < fft_size; i++) {
        magnitudeHigh += powf(((testApp*)ofGetAppPtr())->magnitude[i], 0.25);
    }
    
    float scale = 0.25;
    
    ofTranslate(-ofGetWidth()/2, -ofGetHeight()/2);
    glEnable(GL_DEPTH_TEST);
    //glEnable(GL_CULL_FACE);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);

    for (int j = 0; j < ofGetHeight(); j += 40) {
        for (int i = 0; i < ofGetWidth(); i += 40) {
            ofPushMatrix();
            ofTranslate(i, j, 0);
            float add = (((testApp*)ofGetAppPtr())->avg_power);
            float force = stiffness * -rot[i] + add;
            float acceleration = force / mass;
            vec[i] = damping * (vec[i] + acceleration);
            rot[i] += vec[i];
            //ofRotateX(rot[i]);
            ofRotateX(rot[i] + i * 0.15);
            ofRotateY(rot[i]*1.5 + j * 0.15);
            //ofRotateY(rot[i]*(0.2 + i / 500.0));
            //ofRotateZ(rot[j]*(0.3 + j / 500.0));
            ofSetColor(magnitudeLow * scale, magnitudeMid * scale, magnitudeHigh * scale);
            ofBox(0, 0, 0, 30 + add * 0.8);
            if (add > 0) {
                ofNoFill();
                ofEnableSmoothing();
                ofSetLineWidth(2);
                //ofSetColor(63, 63, 63);
                ofSetColor(magnitudeLow * scale * 1.5, magnitudeMid * scale * 1.5, magnitudeHigh * scale * 1.5);
                ofBox(0, 0, 0, 30 + add * 2.0);
                ofFill();
                ofSetLineWidth(1);
                ofDisableSmoothing();
            }
            ofPopMatrix();
        }
    }
    glDisable(GL_DEPTH_TEST);
    //glDisable(GL_CULL_FACE);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
}
コード例 #17
0
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();
}
コード例 #18
0
ファイル: testApp.cpp プロジェクト: MrMdR/julapy
void testApp :: drawCirclePacker ()
{
	ofFill();
	circlePacker.draw();

	if( !bSmooth )
		return;

	ofNoFill();
	ofEnableSmoothing();
	
	circlePacker.draw();
	
	ofDisableSmoothing();
}
コード例 #19
0
//--------------------------------------------------------------
void testApp::draw(){
    ofBackground(0);
    
    
    
    if (bTrails){
        
        fbo.begin();
        for (int i = 0; i < particles.size(); i++){
            ofSetColor(0);
            particles[i]->draw();
        }
        fbo.end();
        
        ofSetColor(255);
        fbo.draw(0, 0);
        
        if (bPrintScreen){
            ofSaveScreen("screenshot-"+ofGetTimestampString()+".png");
            bPrintScreen = false;
        }
    } 
    
    if (bPrintScreen){
        ofBeginSaveScreenAsPDF("screenshot-"+ofGetTimestampString()+".pdf", false);
    }
    
    for (int i = 0; i < particles.size(); i++){
        ofSetColor(0);
        particles[i]->draw();
    }
    
    if (bPrintScreen){
        ofEndSaveScreenAsPDF();
        bPrintScreen = false;
    }
    
    
    if (bDrawField){
        ofSetColor(255,100);
        normals.draw(0,0,ofGetWidth(),ofGetHeight());
        ofDisableSmoothing();
        ofSetColor(100);
        VF.draw();
        ofEnableSmoothing();
    }
    
}
コード例 #20
0
//--------------------------------------------------------------
void testApp::draw(){
	ofSetColor(127, 127, 127, 200);
	ofNoFill();
	ofEnableSmoothing();
	ofBeginShape();
	for (int i = 0; i < particles.size(); i++){
		ofCurveVertex(particles[i].pos.x, particles[i].pos.y);
	}
	ofEndShape();
	ofDisableSmoothing();
	
	ofSetColor(255, 255, 255);
	ofFill();
	for (int i = 0; i < particles.size(); i++){
		pimg.draw(particles[i].pos.x - 16, particles[i].pos.y - 16);
	}
}
コード例 #21
0
ファイル: testApp.cpp プロジェクト: MrMdR/julapy
void testApp :: draw()
{
	ofBackground( 20, 20, 20 );
	ofEnableAlphaBlending();
	
	if( smoothing )
		ofEnableSmoothing();
	else
		ofDisableSmoothing();
	
	glBlendFunc( blendModes[ blendModeIndex * 2 + 0 ], blendModes[ blendModeIndex * 2 + 1 ] );
	
	tileSaver.begin();
	
	glPushMatrix();
	glTranslatef( renderArea.x, renderArea.y, 0 );

//	drawSquareNoise( &fields[ 0 ] );
//	drawTraingleStatic();
//	drawTriangleNoise( &fields[ 0 ] );
	
	for( int i=0; i<fieldsTotal; i++ )
		drawTriangleNoise( &fields[ i ] );
	
//	for( int i=0; i<fieldsTotal; i++ )
//		drawTriangleVideo( &fields[ i ] );
	
//	tfVideo.draw();
	
	glPopMatrix();
	
	tileSaver.end();

	if( tileSaver.bGoTiling )
		return;
	
	if( screenGrabUtil.isRecording() )
		screenGrabUtil.save();
	
	glBlendFunc( GL_ONE, GL_ZERO );

	gui.draw();
	
	if( showDebug )
		drawDebug();
}
コード例 #22
0
ファイル: ofApp.cpp プロジェクト: flair2005/Cell
void ofApp::setup()
{
    //ofDisableArbTex();
	//ofEnableArbTex();
    ofSetFullscreen(true);
	ofSetLogLevel(OF_LOG_SILENT);
    //	ofSetLogLevel(OF_LOG_ERROR);
    //	ofSetLogLevel(OF_LOG_VERBOSE);
	ofSetVerticalSync(true);
	ofBackground(30);
	ofDisableSmoothing();
	ofEnableAlphaBlending();
    ofRegisterURLNotification(this);
    ofSetCircleResolution(10);
	glEnable(GL_DEPTH_TEST);
    
	isKinectAttached = true;
    
    
    gui.setup();
    
	if (isKinectAttached)
        kinectManager.init();
	
	resourceManager.init();
	sceneManager.init(&kinectManager, &resourceManager);
    
    sceneManager.cloudTagMan.buildCloudTags();
	sceneManager.cloudTagMan.updateTags();
    
    isFirstFrame = false;
	isPaused = false;
    
    frameRate = targetframeRate;
    ofSetFrameRate(frameRate);
    
#ifdef CHINESE_CELL
    isLoadingXml = false;
    isNewIndexXml = false;
	isNewTagDataXml = false;
	ofRegisterURLNotification(this);
	timesLoaded = 0;
	isFirstIndexLoad = true;
#endif
}
コード例 #23
0
void MouseCircleFollow::draw(){
	float trans;
	int transInt;
	int blueRed = 108;
	int blueGreen = 203;
	int blueBlue = 218;
	int orangeRed = 255;
	int orangeGreen = 110;
	int orangeBlue = 25;
	int gridWhite = 235;
	
	//  draw grid
	ofDisableSmoothing();
	ofSetLineWidth(1);
	ofSetColor(gridWhite, gridWhite, gridWhite);
	for (int YY= 0;  YY < (ofGetScreenHeight()) ; YY += 50 ) { ofLine (0, YY, ofGetScreenWidth() , YY); }   
	for (int XX = 0; XX < (ofGetScreenWidth()) ; XX += 50 ) { ofLine (XX, 0, XX, ofGetScreenHeight() ); }
	ofSetLineWidth(2);
	ofEnableSmoothing();
	
	// draw text
	ofSetColor(orangeRed, orangeGreen, orangeBlue, 222);
	verdana30.drawString("EKG Measurements", 20, ofGetHeight()-20);
	
	// draw line
	for(int jj = 0; jj<numOfCircles; jj ++) {  
		
		ofSetColor(blueRed,blueGreen,blueBlue, 255 * (float(jj)/float(numOfCircles)) );    //having BIG problems with the alpha part...usually won't accept transInt variable, will behave strangely with simple integers too (like "10"!)
		
		ofLine ((jj-1), yPos[jj-1], (jj), yPos[jj] ); 
		
		if ( ((jj-ii) > 0) && ( (jj-ii) <= 255) ) { 
			trans = ceil ((250 * ((jj-ii)/200)) );
			transInt = int(trans);
			
		}
		
		else if ( ((jj-ii) >= 0) && ( (jj-ii) <= 50) ) { }
		
		else { 
			ofSetColor(blueRed,blueGreen,blueBlue, 255); 
			ofLine ((jj-1), yPos[jj-1], (jj), yPos[jj] );
		}
	}
}
コード例 #24
0
//--------------------------------------------------------------
void ofApp::draw() {

    ofBackgroundGradient(ofColor(240),ofColor(210),OF_GRADIENT_BAR);

    ofSetColor(170);
    for(int i=0; i<(ofGetWidth()-rightMargin)/speed.getValue(); i++) {
        ofDrawLine(i*speed.getValue(),120,i*speed.getValue(),ofGetHeight());
        if(showPos)
            ofDrawBitmapString(ofToString(i)+"s",i*speed.getValue(),ofGetHeight()-20);
        else
            ofDrawBitmapString(ofToString(i*speed.getValue(),0)+"p",i*speed.getValue(),ofGetHeight()-20);
    }

    ofSetColor(20);
    ofDrawLine(ofGetWidth()-rightMargin,0,ofGetWidth()-rightMargin,ofGetHeight());

    for(int i=0; i<(int)trail.size(); i++) {
        ofEnableSmoothing();
        ofDrawCircle(x,y[i],radius);
        trail[i].draw();


        ofDisableSmoothing();
        ofDrawLine(0,60*(i+2),ofGetWidth(),60*(i+2));

        float rectY = 60*(i+2);
        ofDrawRectangle(ofGetWidth()-rightMargin+10,rectY,10,y[i]-rectY);
    }

    ofDrawBitmapString("constant",ofGetWidth()-160,60*2-4);
    ofDrawBitmapString("ofNoise(t)",ofGetWidth()-160,60*3-4);
    ofDrawBitmapString("ofSignedNoise(t)",ofGetWidth()-160,60*4-4);
    ofDrawBitmapString("ofRandom(-1,1)",ofGetWidth()-160,60*5-4);
    ofDrawBitmapString("sin(TWO_PI*t)",ofGetWidth()-160,60*6-4);
    ofDrawBitmapString("(sin(TWO_PI*t)+1)/2",ofGetWidth()-160,60*7-4);
    ofDrawBitmapString("modulo(t,1)",ofGetWidth()-160,60*8-4);
    ofDrawBitmapString("modulo(t,1)*2-1",ofGetWidth()-160,60*9-4);

    ofDrawBitmapString("fps:" + ofToString(ofGetFrameRate(),0),ofGetWidth()-80,20);
    ofDrawBitmapString("t:" + ofToString(t,2),ofGetWidth()-80,35);
    ofDrawBitmapString("x:" + ofToString(x,2),ofGetWidth()-80,50);

}
コード例 #25
0
ファイル: testApp.cpp プロジェクト: MrMdR/julapy
void testApp :: drawShapes ()
{
	ofEnableSmoothing();
	
	for( int i=0; i<shapes.size(); i++ )
	{
//		ofFill();
//		ofSetColor( 0xFFFFFF );
//		
//		drawShape( shapes[ i ] );
		
		ofNoFill();
		ofSetColor( 0xFF0000 );
		
		drawShape( shapes[ i ] );
	}
	
	ofDisableSmoothing();
}
コード例 #26
0
void ObjLines::draw()
{
    ofEnableSmoothing();
	
	ofSetHexColor(0xFF00FF);
    
    int segmentHeight = height / 21;
    
	for (int i = 0; i < 20; i++){
		ofLine(x,y + (i*3),x + width, y + (i*segmentHeight));
	}
	
    ofDisableSmoothing();
	
    ofSetColor(255,255,255);
	ofDrawBitmapString("lines", x + 5, y + 15);
    
    AbstractObject::draw();
}
コード例 #27
0
ファイル: Mitosis.cpp プロジェクト: joelanman/project01
void Mitosis::draw(){
    if(!isBody()) return;
    if(picked) return;
	
	ofPushMatrix();
	ofTranslate(getPosition().x, getPosition().y, 0);
	ofRotate(rot, 0, 0, 1);
    
    ofSetCircleResolution(10);
    
    ofSetColor(120);
    ofCircle(-10, -5, 5);
    ofCircle(10, -5, 5);
    ofCircle(0, 10, 5);
    
    
    ofNoFill();
    ofEnableSmoothing();
    ofSetLineWidth(2);
    ofCircle(-10, -5, 5);
    ofCircle(10, -5, 5);
    ofCircle(0, 10, 5);
    ofSetColor(200);
    ofSetCircleResolution(30);
    ofCircle(0, 0, getRadius());
    ofDisableSmoothing();
    ofFill();
    
    ofPushStyle();
    ofEnableAlphaBlending();
    
    if(isSleeping()) {
        ofSetColor(255, 100);
        ofCircle(0, 0, getRadius());
    }
    
    ofPopStyle();
    
    ofPopMatrix();
    rot+=0.5;
    if((ofGetElapsedTimeMillis() - created) > lifespan ) dead = true;
}
コード例 #28
0
void StSyncopationMonitorColor::drawGrid() {
	ofDisableSmoothing();
	int div1 = app->tidal->max2;
	int div2 = app->tidal->max2 / 8;
	ofSetColor(63);
	for (int i = 0; i < div1; i++) {
		float x = ofMap(i, 0, div1, 0, width);
		ofDrawLine(x, 0, x, height);
	}
	ofSetColor(191);
	for (int i = 0; i < div2; i++) {
		float x = ofMap(i, 0, div2, 0, width);
		ofDrawLine(x, 0, x, height);
	}
	ofSetColor(220);
	ofNoFill();
	ofDrawRectangle(0, 0, width, height);
	ofFill();
	ofEnableSmoothing();
}
コード例 #29
0
void drawingLayer::drawLayer()
{
    ofSetColor(lineColor);
    ofNoFill();
    ofEnableSmoothing();
    ofPushMatrix();
    ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
    if (vertexArray.size() > 0){
        
        for (int j = 0; j < SLICES; j++){
            ofPushMatrix();
            ofBeginShape();
            float r = ofDegToRad(360/SLICES);
            ofRotate(360/SLICES*j);
            for (int i = 0; i < vertexArray.size(); i++){
                ofCurveVertex(vertexArray[i]);
            }
            ofEndShape();
            ofPopMatrix();   
        }
        
        ofPushMatrix();
        ofScale(-1,1);
        
        for (int j = 0; j < SLICES; j++){
            ofPushMatrix();
            ofBeginShape();
            float r = ofDegToRad(360/SLICES);
            ofRotate(360/SLICES*j);
            for (int i = 0; i < vertexArray.size(); i++){
                ofCurveVertex(vertexArray[i]);
            }
            ofEndShape();
            ofPopMatrix();
        }
        ofPopMatrix();
    }
    
    ofPopMatrix();
    ofDisableSmoothing();
}
コード例 #30
0
ファイル: ofApp.cpp プロジェクト: ralphlizard/drone-tracker-2
void ofApp::setup(){
    int w = ofGetScreenWidth(); int h = ofGetScreenHeight();
    ofSetWindowShape(1400, 500);
    ofSetFullscreen(false);
    
    camW = 1720; camH = 1080;
    cam.setup(camW,camH,0);
    
    vid.setDeviceID(0);
    vid.initGrabber(camW, camH);
    
    artk.setup(camW, camH);
    artk.setThreshold(0);

    ofDisableSmoothing();
    sound.loadSound("shutter.wav");
     
    scale = 0.4;
    timeInterval = 5;
    closeSize = 120;
}