예제 #1
0
void GeoHands::drawHands(ofImage geoHands)
{

    if(Interval ==0) {
        ofSetColor(255,255,255,100);
        geoHands.draw(pos.x-185,pos.y-185);
    }
    if(Interval ==1) {
        ofSetColor(130,255,0,70);
        geoHands.draw(pos.x-185+ofRandom(-5,5),pos.y-185+ofRandom(-5,5));
    }
    if(Interval ==2) {
        ofSetColor(255,230,0,80);
        geoHands.draw(pos.x-185+ofRandom(-10,10),pos.y-185+ofRandom(-10,10));
    }
    if(Interval ==3) {
        ofSetColor(255,17,0,90);
        geoHands.draw(pos.x-185+ofRandom(-15,15),pos.y-185+ofRandom(-15,15));
    }
    if(Interval ==4) {
        ofSetColor(255,0,0,100);
        geoHands.draw(pos.x-185+ofRandom(-20,20),pos.y-185+ofRandom(-20,20));
    }



}
예제 #2
0
//--------------------------------------------------------------
void testApp::draw(){
	ofSetColor(255);
	img.draw(0,0);
	img2.draw(0,200);
	img3.draw(0,400);

	ofSetColor(255,0,0);
	ofDrawBitmapString(ofToString(ofGetFrameRate()),10,10);
}
예제 #3
0
	void BPMTapper::draw(int x, int y, int r, ofImage &image) {
		int d = r * 2;
		glColor3f(1, 0, 0);
		ofEnableAlphaBlending();
		image.draw(x, y, d * sin1, d * sin1);		x += d;
		image.draw(x, y, d * sin2, d * sin2);		x += d;
		image.draw(x, y, d * sin4, d * sin4);		x += d;
		image.draw(x, y, d * sin8, d * sin8);		x += d;
		image.draw(x, y, d * sin16, d * sin16);	x += d;
	}
//--------------------------------------------------------------
void ofApp::draw(){
    
    ofSetColor(255,255,255,255);
    imageCrystal.draw(0,0);  // draw image at (0,0)
    ofSetColor(128,128,128,128);
    imageCrystal.draw(50,50, imageCrystal.width/3, imageCrystal.height/3);  // draw image at (50,50) at 1.5 scale
    
    
    ofSetColor(255,255 , 0,128);
    imageCrystal.draw(80,100, imageCrystal.width/2, imageCrystal.height/1.5);  // draw image at (50,50) at 1/2 scale

    ofSetColor(0,255 ,255,128);
    imageCrystal.draw(point);  // draw image at (50,50) at 1/2 scale
  
}
예제 #5
0
void ofApp::draw()
{
	// draw image
	ofSetColor(255);
	img1.draw(0, 0);
	synth.draw(w, 0);
	
	// draw text
	stringstream ss;
	ss << "drag and drop a image file to this window \n";
	ss << "file name: " + cur_file+ " \n";
	ss << "avarage: " + ofToString(avarage_pixel_value);
	
	ofSetColor(0);
	ofDrawBitmapString(ss.str(), ofPoint(20, 20));
}
예제 #6
0
    void draw(){
//        sampleImg.draw(0, 0, 450, 450);
        
        cannyImg.draw(0, 0, 450, 450);
        cannyInvertImg.draw(450, 0, 450, 450);
        
    }
예제 #7
0
        void draw(){
            wc.begin();
            if(!switchVideo){
                wc.setUniformTexture("colorMap", img.getTexture(),  1);
                wc.setUniformTexture("heightMap",gray.getTexture(), 2);
            }
            else{
                wc.setUniformTexture("colorMap", player.getTexture(), 1);
                fboDepth.begin();
                player.draw(0,0);
                fboDepth.end();
                wc.setUniformTexture("heightMap",fboDepth.getDepthTexture(),2);
            }
            wc.setUniform1f("time", ofGetElapsedTimef()*time);
            wc.setUniform1f("gradientStep", stepGradient);
            wc.setUniform1f("advectStep",   advectStep);
            wc.setUniform1f("flipHeightMap",flipHeightMap);
            wc.setUniform4f("advectMatrix",advectMatrix->w,advectMatrix->x,advectMatrix->y,advectMatrix->z);

            fbo.draw(0,0);

            wc.end();
            img.draw(0,0,img.getWidth()/4,img.getHeight()/4);
            player.draw(img.getWidth()/4,0,img.getWidth()/4,img.getHeight()/4);
            gui.draw();
        }
예제 #8
0
    void update()
	{
		fbo.begin();
			ofClear(0, 0, 0, 0);
			testImage.draw(0, 0);
        fbo.end();
    }
예제 #9
0
//--------------------------------------------------------------
void ofApp::draw(){
	//Set up gray background
	ofBackground( 128, 128, 128 );

	//Draw image with top left corner x=100, y=50 pixels
	image.draw( 100, 50 );
}
예제 #10
0
//--------------------------------------------------------------
void testApp::draw(){

    img.draw(imgPos.x, imgPos.y, w,h);
    img.setAnchorPercent(0.5, 0.5);



}
예제 #11
0
void ofApp::show_merge(int play_cnt) {
    memcpy(tmp, recorded + image_size * play_cnt, image_size);
    memcpy(merged, show, image_size);
    bgs(tmp);
    image_merge(merged, tmp, 0);
    img.setFromPixels(merged, width, height, OF_IMAGE_COLOR);
    img.draw(width, height);
}
예제 #12
0
void RunningDraw::drawTitle(ofImage title){
    Settings* settings = Settings::getInstance();

    float title_x= settings->getWidth() / 2 - title.getWidth() * SCALE/2;
    float title_y = settings->getTitleY();

    title.draw(title_x, title_y, title.getWidth() * SCALE, title.getHeight() * SCALE);
}
예제 #13
0
파일: main.cpp 프로젝트: drakh/glslMaterial
    void draw() {
        ofBackgroundGradient(64, 0);

	if(reflect || sreflect) 
		env.draw(0,0,env.getWidth()/8,env.getHeight()/8);
	if(sreflect) 
		env1.draw(env.getWidth()/8,0,env1.getWidth()/8,env1.getHeight()/8);

	ofEnableDepthTest();
        cam.begin();
        shader.begin();

	if(sreflect){
//        	shader.setUniform3f("CameraPos",cam.getGlobalPosition().x, cam.getGlobalPosition().y, cam.getGlobalPosition().z);
//		shader.setUniformMatrix4f("ModelWorld4x4",cam.getGlobalTransformMatrix());
        	shader.setUniform3f("CameraPos",cam.getPosition().x, cam.getPosition().y, cam.getPosition().z);
		shader.setUniformMatrix4f("ModelWorld4x4",cam.getModelViewMatrix());//getLocalTransformMatrix());
	        shader.setUniformTexture("frontMap",  env,1);
	        shader.setUniformTexture("backMap",  env1,2);
	}

	if(reflect){
        	shader.setUniformTexture("colorMap",env1,1);
	        shader.setUniformTexture("envMap",  env,2);
	}else if(sreflect==false){
        	shader.setUniformTexture("texture", img, 1);
        	shader.setUniform1f("time", ofGetElapsedTimef());
	}

	if(cube)
		ofDrawBox(200);
	else {
		ofTranslate(0,-150,0);
		ofRotateX(-90);
		ofRotateY(-90);
		ofRotateZ(45);
		model.drawFaces();
	}

        shader.end();
        cam.end();
	ofDisableDepthTest();

        ofDrawBitmapString(ofToString((int) ofGetFrameRate()), 10, 20);
    }
예제 #14
0
	void draw(){
		string msg = "";
		vector<string> p = deep.getPrediction();
		for(int i = 0; i < p.size(); i++){
			msg += ofToString(i)+") "+p[i]+"\n";
		}
		img.draw(0,0);
		ofDrawBitmapStringHighlight(msg,10,10);
	}
예제 #15
0
void testApp::draw() {
	ofBackground(0);
	
	
	cameraImage.draw(0, 0);
	
	ofSetColor(255);
	ofDrawBitmapString(ofToString((int) timer.getFrameRate()), wrapper.cameraWidth, wrapper.cameraHeight+20);
}
예제 #16
0
void ofxImageTS::divider(ofImage image,float divW, float divH, float width, float height){
    ofFbo buffer;
    buffer.begin();
    for(int i = 0; i < divW; i++) {
        for(int j = 0; j < divH; j++) {
            image.draw((width/divW) * i,(height/divH) * j,width/divW,height/divH);
        }
    }
    buffer.end();
}
예제 #17
0
void ofxImageTS::spaceTime(ofImage image, float depth, float density, float width, float height){

    ofFbo buffer;
    buffer.begin();
    ofSetRectMode(OF_RECTMODE_CENTER);
    for(float i = 0; i < depth; i += 1/density){
        image.draw(width/2,height/2,width/i,height/i);
    }
    buffer.end();
}
예제 #18
0
//--------------------------------------------------------------
void testApp::draw(){
    
    ofSetHexColor(0xFFFFFF);
    
    ci::gl::draw( ci_texture , ci::Vec2f(0,0) );
    ofDrawBitmapString("ofImage to ci::Texture", 0,20);
    
    of_image.draw(ofGetWidth()/2, 0);
    ofDrawBitmapString("ci::Surface to ofImage", ofGetWidth()/2,20);
    
}
void dpCameraUnit_ShaderFX::update(ofImage& pix){

	mBuffer.begin();
	ofClear(0, 0, 0, 255);
	ofSetColor(255);
	pix.draw(0,0,mBuffer.getWidth(), mBuffer.getHeight());

	mBuffer.end();

	mFx.applyFx();

}
예제 #20
0
//------------------------------------------------------------
void Particle::draw(ofImage &_image){
    
    ofPushStyle();
    
    ofSetColor(color, 255*sin(ofMap(life,0.0,initLife,0.0,PI)));
    ofSetRectMode(OF_RECTMODE_CENTER);
               
    float size = 580 * sin(ofMap(life,0.0,initLife,0.0,PI));
    _image.draw( *this, size, size );
    
    ofPopStyle();
}
예제 #21
0
//--------------------------------------------------------------
void testApp::draw(){

	ofEnableAlphaBlending();
	if(showSite) {
		site.draw(ofGetWidth()/2, ofGetHeight()/2);
	} else {
		
	// draw the incoming, the grayscale, the bg and the thresholded difference
	ofSetColor(0xffffff);
	glPushMatrix();
	glScalef(ofGetWidth()/colorImg.getWidth(), ofGetHeight()/colorImg.getHeight(), 1);
	colorImg.draw(0, 0);
	for(int i = 0; i < particles.size(); i++) {
		particles[i].draw();
	}
	if(gui.isOn())	mouths.draw();
	glPopMatrix();
	
	
	
	
/*
	grayImage.draw(360,20);
	grayBg.draw(20,280);
	grayDiff.draw(360,280);

	// then draw the contours:

	ofFill();
	ofSetColor(0x333333);
	ofRect(360,540,320,240);
	ofSetColor(0xffffff);

	// we could draw the whole contour finder
	//contourFinder.draw(360,540);

	// or, instead we can draw each blob individually,
	// this is how to get access to them:
    for (int i = 0; i < contourFinder.nBlobs; i++){
        contourFinder.blobs[i].draw(360,540);
    }

	// finally, a report:

	ofSetColor(0xffffff);
	char reportStr[1024];
	sprintf(reportStr, "bg subtraction and blob detection\npress ' ' to capture bg\nthreshold %i (press: +/-)\nnum blobs found %i, fps: %f", threshold, contourFinder.nBlobs, ofGetFrameRate());
	ofDrawBitmapString(reportStr, 20, 600);
*/
	gui.draw();
	}
}
예제 #22
0
	// ---------------------------------------------------------------------------------------
	//
	void draw()
	{
		ofSetColor( ofColor::white );
		ofDisableAlphaBlending();
		destImage.draw( 0, 0, ofGetWidth(), ofGetHeight() );
		
		if( drawGui )
		{
			gui.draw();
		}

		drawStringShadowed( fontSmall,  "Method " + methodNames.at(methodIndex), 5, ofGetHeight() - 25 );
		drawStringShadowed( fontSmall,  "Scale " + ofToString( Scale * ScaleMultiplier ), 5, ofGetHeight() - 5 );
		drawStringShadowed( fontSmall, ofToString( ofGetFrameRate(), 2), ofGetWidth() - 30, ofGetHeight() - 5);
	}
예제 #23
0
//  draw the particle that corresponds to idx (its number)
//  most of this code goes to drawing the gyro halo radius and hsv color
void NPPDraw (int idx) {
  ofColor c = ofColor(128, 0, 250);  // set hsv
  int bDir = (int(NPPoints[idx].y) & 0x100) >> 8;  // breathing direction
  int rDel = (int(NPPoints[idx].y) & 0xF0) >> 4;   // radius delta size
  
  if (bDir == 0) { // breathe radius & hue relative to Y
    NPPRadius[idx] = 20 + rDel;// y pos controls width 
    c.setHue(rDel * 5 + 100); // add delta to min hue
  } else {
    NPPRadius[idx] = 20 + 16 - rDel;
    c.setHue(rDel * -5 + 100 + 75); // minus delta from max hue
  }
  ofSetColor(c); 
  ofCircle (NPPoints[idx], NPPRadius[idx]);  // given x,y draw the circle
  ofSetColor(255,255,255);
  gyroNom.draw(NPPoints[idx].x-20,NPPoints[idx].y-20,40,40);
}
예제 #24
0
//--------------------------------------------------------------
void testApp::draw(){
    ofSetColor(255, 255, 255);
    colorImg.draw(0, 0, ofGetWidth(), ofGetHeight());
    
    glPushMatrix();
    glScalef(ofGetWidth() / (float)greyImageSmall.getWidth(), ofGetHeight() / (float)greyImageSmall.getHeight(), 1);
//    haarTracker.draw(0, 0);
    ofNoFill();
	for(int i = 0; i < haarFinder.blobs.size(); i++) {
		ofRectangle cur = haarFinder.blobs[i].boundingRect;
//		ofRect(cur.x, cur.y, cur.width, cur.height);
        int iw = cur.width * 1.4;
        img.draw(haarFinder.blobs[i].centroid, iw, iw * img.getHeight() / img.getWidth());
	}

    glPopMatrix();
}
void Planet::draw(ofImage &planet) {
    
    ofPushMatrix(); {
        
        ofTranslate(pos);
        
        if (!isExploded ) {
            planet.draw(0, 0, diam, diam);
        } else {
            ofSetColor(255, lifeCount);
            explosion->draw(0, 0, diam, diam);
        }
        
        ofSetColor(255);
        
    }ofPopMatrix();
    
}
예제 #26
0
 void draw() {
     ofPushMatrix();
     float screenWidth = config["screen"]["width"];
     float screenHeight = config["screen"]["height"];
     float camWidth = config["camera"]["width"];
     float camHeight = config["camera"]["height"];
     ofTranslate(screenWidth / 2, screenHeight / 2);
     ofRotateZDeg(config["camera"]["rotate"]);
     ofTranslate(-camWidth / 2, -camHeight / 2);
     if(cam->isInitialized()) {
         cam->draw(0,0);
     }
     clipping.draw(0, 0);
     ofPopMatrix();
     if(cam->isInitialized()) {
         drawHistogram(cam->getPixels(), mouseY);
     }
 }
예제 #27
0
/*
 Draw area with image
 */
void CenterContainer::draw(ofImage img_){
    ofPushStyle();

    if(ofGetElapsedTimeMillis() - clickTime < 1000){
        float difr = 255-color.r;
        float difg = 255-color.g;
        float difb = 255-color.b;
        
        float newr = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difr);
        float newg = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difg);
        float newb = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difb);
        
        path.setColor(ofColor(ofClamp(255-newr, 0, 255),ofClamp(255-newg, 0, 255),ofClamp(255-newb, 0, 255),color.a));//white to color
    }else {
        path.setColor(color);
    }
    path.draw();
    
    LineSegment line1 = LineSegment(nw,se);
    LineSegment line2 = LineSegment(ne,sw);
    ofVec2f intersection;
    line1.Intersect(line2, intersection);
    if(ofGetElapsedTimeMillis() - clickTime < 1000){
        float difr = 255-color.r;
        float difg = 255-color.g;
        float difb = 255-color.b;
        float newr = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difr);
        float newg = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difg);
        float newb = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difb);
        
        ofSetColor(ofColor(ofClamp(color.r+newr, 0, 255), ofClamp(color.g+newg, 0, 255),ofClamp(color.b+newb, 0, 255),color.a));
        //color to white
    }else { 
        ofSetColor(ofColor::white,color.a);
        
    }
    
    img_.setAnchorPercent(0.5, 0.5); 
    img_.draw(intersection.x, intersection.y,30,30);
    
    ofPopStyle();
    
}
예제 #28
0
파일: ofApp.cpp 프로젝트: Miaao/NoneLinear
//--------------------------------------------------------------
void ofApp::draw(){
    ofSetColor(255,255,255);

    /* //Another way of zooming
    float zoom = 0.08;
    glPushMatrix();
    glTranslatef(100,50,0);
    glScalef(zoom,zoom,0);
    image.draw(w/8, h/8);
    glPopMatrix();*/

    image.draw(imgPos.x, imgPos.y, image.width, image.height);
    ofVec2f mousePos(ofGetMouseX(), ofGetMouseY());

    ofSetColor(57, 74, 84);
    ofNoFill();
    ofSetLineWidth(10);
    ofSetCircleResolution(500);
    ofCircle(mousePos.x, mousePos.y, radius);

    ofPath magnifierPath;
    ofMesh magnifierMesh;
    magnifierPath.setCircleResolution(100);
    magnifierPath.setFilled(true);
    magnifierPath.circle(mousePos.x, mousePos.y, radius);
    magnifierPath.close();
    magnifierMesh=magnifierPath.getTessellation();

    for (int i=0; i<magnifierMesh.getNumVertices(); i++) {
        ofVec2f vertPos = magnifierMesh.getVertex(i);
        ofVec2f zoomedPos = ((vertPos - mousePos) / zoomFactor) + mousePos;
        ofVec2f uvPos = zoomedPos - imgPos;
        magnifierMesh.addTexCoord(uvPos);
    }


    ofSetColor(255, 255, 255);
    image.bind();
    magnifierMesh.draw();
    image.unbind();

}
예제 #29
0
 void draw() {
     if (isShootingStar) {
         if (ofGetElapsedTimef() - shootingTime > .5) {
             return;
         }
     }
     ofPushStyle();
     ofSetRectMode(OF_RECTMODE_CENTER);
     ofFill();
     ofPushMatrix();
     ofTranslate(pos.x, pos.y);
     if (isConstellation) {
         ofSetColor(255, 255, 0);
     } else {
         ofSetColor(255);
     }
     starImg.draw(0, 0, magnitude * 10, magnitude * 10);
     ofPopMatrix();
     ofPopStyle();
 }
예제 #30
0
void GeoParticle::draw(ofImage mGrad, ofImage explosionSprite)
{
	if(m_isExploding == true){
		
		for(int j = 0 ; j < 50; j ++){
			
			ofPushMatrix();

				if(m_gradNum == 0 ){ofSetColor(251,236,119,alphaExplode);}
				if(m_gradNum == 1 ){ofSetColor(238,158,100,alphaExplode);}
				if(m_gradNum == 2 ){ofSetColor(211,75,63,alphaExplode);}
				if(m_gradNum == 3 ){ofSetColor(87,193,235,alphaExplode);}
				if(m_gradNum == 4 ){ofSetColor(72,165,76,alphaExplode);}
				if(m_gradNum == 5 ){ofSetColor(169,233,180,alphaExplode);}

				explosionSprite.draw(pos.x+ofRandom(-alphaExplode,alphaExplode),pos.y+ofRandom(-alphaExplode,alphaExplode), 30,30);
			ofPopMatrix();
			
		}
	}
	ofSetColor(255);
	mGrad.bind();

	ofPushMatrix();
		ofTranslate(pos.x, pos.y);
		ofScale(GeoSize, GeoSize);
		//set alpha for explosion
		ofSetColor(255, (int)255 - 255 * (m_explodeTime / s_explosionTimeout));
		m_vbo.bind();
		glDrawArrays(GL_TRIANGLES, 0, m_numTriangles*3);
		m_vbo.unbind();
	ofPopMatrix();

	mGrad.unbind();

	
}