示例#1
0
文件: menu.cpp 项目: serman/muncyt
//--------------------------------------------------------------
void menu::draw() {
	ofBackground(ofColor::black);



	// clear fbos
	if(bDrawFbos) {
		ofSetColor(255,255,255);
		
		fbo1.begin();	ofBackground(0,0,0); ofEnableAlphaBlending();	fbo1.end();
		fbo2.begin();	ofBackground(0,0,0); ofEnableAlphaBlending();	fbo2.end();
		fbo3.begin();	ofBackground(0,0,0); ofEnableAlphaBlending();	fbo3.end();
		fbo4.begin();	ofBackground(0,0,0); ofEnableAlphaBlending();	fbo4.end();	
		
		draw4Forces_fbos();
		
		fbo1.begin();	ofDisableAlphaBlending();	fbo1.end();
		fbo2.begin();	ofDisableAlphaBlending();	fbo2.end();
		fbo3.begin();	ofDisableAlphaBlending();	fbo3.end();
		fbo4.begin();	ofDisableAlphaBlending();	fbo4.end();
		
		fbo1.draw(centroScreen.x, centroScreen.y);
		fbo2.draw(centroScreen.x-fbo2.getWidth(), centroScreen.y);
		fbo3.draw(centroScreen.x-fbo3.getWidth(), centroScreen.y-fbo3.getHeight());
		fbo4.draw(centroScreen.x, centroScreen.y-fbo4.getHeight());
		
	}	
	else {
		if(bDraw4Forces) {
            ofEnableAlphaBlending();
			draw4Forces();
            ofDisableAlphaBlending();
		}
		else {
             ofEnableAlphaBlending();
			draw2Colors();
              ofDisableAlphaBlending();
		}
	}


    // Botones para TUIO
    touchElements.draw();
	
	// TUIOS
	//    tuioClient.drawCursors();	
//    ofPushMatrix(); //colocamos el canvas en su posicion centrada
//	ofTranslate((ofGetWidth()-W_WIDTH)/2, 0);
    hands.draw();
//	ofPopMatrix();
	
	ofPushStyle();
	borde.draw();
	ofPopStyle();
	
	ofPushStyle();
	string info = "";
	info += "Press [c] for circles\n";
	info += "Press [b] for blocks\n";
	info += "(4) draw 4Forces: "+ofToString(bDraw4Forces)+"\n";
	info += "(r) Modo Fuerza Color: "+ofToString(fRed)+"\n";
	info += "(f) Modo FBOs: "+ofToString(bDrawFbos)+"\n";
	info += "(d) Fuerza Densidad: "+ofToString(swFuerzaDensidad)+"\n";
	info += "(m) mousePressed: " + ofToString(isMousePressed)+"\n";
	info += "Total Bodies: "+ofToString(box2d.getBodyCount())+"\n";
	info += "Total Joints: "+ofToString(box2d.getJointCount())+"\n\n";
	info += "FPS: "+ofToString(ofGetFrameRate(), 1)+"\n";
    info += "Button Dest" + ofToString(mdisplay.scene);
//	ofSetHexColor(0x444342);
	ofSetHexColor(0xAAAAAA);
    if(     bshowdebug)
        ofDrawBitmapString(info, 30, 30);
	ofPopStyle();
    
    mdisplay.draw();
}
示例#2
0
//--------------------------------------------------------------
void ofApp::draw() {

	ofSetHexColor(0xFFFFFF);
	for (std::vector<Circle>::size_type i = 0; i != circles.size(); i++) {
		Circle * circle = circles[i];
		ofColor color = grabber->getPixelsRef().getColor(circle->x, circle->y);
		circle->color = color;
		circle->drawCircle();
	}

	for(std::vector<Circle*>::iterator circle = added_circles.begin(); circle != added_circles.end(); ++circle) {
		(*circle)->drawCircle();
	}


	ofPushStyle();

	for (std::vector<ofxCvBlob>::size_type i = 0; i != eyes.size(); i++) {
		ofxCvBlob& eye = eyes[i];

		int x;
		int y;


		if (orientation == OF_ORIENTATION_DEFAULT) {
			//Portrait Rightside Up
			x = (eye.boundingRect.y + (eye.boundingRect.height/2)) * haarScaleFactor;
			y = (haarHeight - (eye.boundingRect.x + (eye.boundingRect.width/2))) * haarScaleFactor;

			ofLog() << "ORIENTATION: Portrait";
		} else if (orientation == OF_ORIENTATION_180) {
			//Portrait Upside Down
			x = (haarWidth - (eye.boundingRect.y + (eye.boundingRect.height/2))) * haarScaleFactor;
			y = (eye.boundingRect.x + (eye.boundingRect.width/2)) * haarScaleFactor;

			ofLog() << "ORIENTATION: Portrait (Flipped)";
		} else if (orientation == OF_ORIENTATION_90_RIGHT) {
			//Landscape Right
			x = (haarWidth - (eye.boundingRect.x + (eye.boundingRect.width/2))) * haarScaleFactor;
			y = (haarHeight - (eye.boundingRect.y + (eye.boundingRect.height/2))) * haarScaleFactor;

			ofLog() << "ORIENTATION: Landscape (Flipped)";
		} else {
			//Landscape
			x = (eye.boundingRect.x + (eye.boundingRect.width/2)) * haarScaleFactor;
			y = (eye.boundingRect.y + (eye.boundingRect.height/2)) * haarScaleFactor;

			ofLog() << "ORIENTATION: Landscape";
		}

		int radius1 = eye.boundingRect.width;
		ofEnableDepthTest();
		ofSetColor(0, 0, 255);
		ofCircle(x, y, 100, radius1);
	}
	ofPopStyle();

	if (showPercent) {
		ofSetHexColor(0xFFFFFF);
		stringstream ss;
		ss << percent;
		font.drawString(ss.str(), screenWidth/2, screenHeight/2);
		ss.str("");
	}

}
示例#3
0
void xmlgui::Control::draw() {
	ofSetHexColor(0xFFFFFF);
	ofRect(*this);
	
}
ofxSimpleGuiControl &ofxSimpleGuiControl::setFullColor(bool forceActive) {
	if(isMouseDown() || forceActive) ofSetHexColor(config->fullActiveColor);
	else if(isMouseOver()) ofSetHexColor(config->fullOverColor);
	else ofSetHexColor(config->fullColor);
	return *this;
}
ofxSimpleGuiControl &ofxSimpleGuiControl::set2DSliderBGColor(bool clickable) {
	if(isMouseDown() || isMouseOver() || clickable) ofSetHexColor(config->fullActiveColor);
	else ofSetHexColor(config->emptyColor);
	return *this;
}
示例#6
0
void ofApp::draw() {

    ofBackground(BACKGROUND_COLOR);

    if (appState == SPLASH_SCREEN) {
        imgSplashScreen.draw(0, 0, ofGetWidth(), ofGetHeight());
        if (ofGetElapsedTimeMillis() > 1500) appState = SPLASH_FADE;
        return;
    }

    else if (appState == SPLASH_FADE) {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, 255);
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, 0.0f, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, 0, ofGetWidth(), ofGetHeight());
        }
        splashAlpha -= 2;
        ofSetColor(255, 255, 255, splashAlpha);
        imgSplashScreen.draw(0, 0, ofGetWidth(), ofGetHeight());
        ofDisableAlphaBlending();
        ofPopStyle();
        if (splashAlpha <= 0) appState = ABOUT;
        return;
    }

    else if (appState == ABOUT) {
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, 0.0f, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, 0, ofGetWidth(), ofGetHeight());
        }
        setLanguageBBoxes();
        drawBouncingArrow();
        return;
    }

    drawModules();
    drawLines();
    drawParticles();
    drawTouches();

    if (showSwipeInfo)  {
        ofPushStyle();

        if (isTablet()) ofSetColor(47); // NOTE: previous white font color wasn't readable on iPad;
        else ofSetHexColor(CONSOLE_COLOR);

        int swipeSize = 150;
        int padding = 80;

        imgSwipeInfo.draw(ofGetWidth()/2-swipeSize/2, ofGetHeight()/2, swipeSize, swipeSize);

        string s1 = ofApp::translations["SWIPE_INFO_TOP_LINE"];
        int s1w = swipeFont.getStringBoundingBox(s1, 0, 0).width;
        int s1x = (ofGetWidth() - s1w) / 2;
        int s1y = ofGetHeight()/2 - padding;
        swipeFont.drawString(s1, s1x, s1y);

        string s2;
        if (ofApp::isPhone()) s2 = ofApp::translations["SWIPE_INFO_BOTTOM_LINE_PHONE"];
        else s2 = ofApp::translations["SWIPE_INFO_BOTTOM_LINE_TABLET"];

        int s2w = swipeFont.getStringBoundingBox(s2, 0, 0).width;
        int s2x = (ofGetWidth() - s2w)/2;
        int s2y = ofGetHeight()/2 + swipeSize + padding;
        swipeFont.drawString(s2, s2x, s2y);

        ofPopStyle();
    }

    if (appState == BAR) {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, DEFAULT_ALPHA);
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, aboutY, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, aboutY, ofGetWidth(), ofGetHeight());
        }

        ofDisableAlphaBlending();
        drawArrow(false);
        ofPopStyle();
    }

    else if (appState == ABOUT_ASCENDING) {
        if (aboutY < 15) {
            aboutY = 0;
            appState = ABOUT;
        } else {
            aboutY -= 15;
        }
        if (currentAlpha < 255) currentAlpha += 3;
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, currentAlpha);
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, aboutY, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, aboutY, ofGetWidth(), ofGetHeight());
        }
        ofDisableAlphaBlending();
        ofPopStyle();
    }

    else if (appState == ABOUT_DESCENDING) {
        aboutY += 20;
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, aboutY, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, aboutY, ofGetWidth(), ofGetHeight());
        }
    }

    else if (appState == BAR_ASCENDING) {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, DEFAULT_ALPHA);
        aboutY -= 5;
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, aboutY, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, aboutY, ofGetWidth(), ofGetHeight());
        }
        drawArrow(false);
        ofDisableAlphaBlending();
        ofPopStyle();
    }

    else if (appState == BAR_DESCENDING) {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, DEFAULT_ALPHA);
        aboutY += 5;
        if(ofApp::isPhone()){
            imgAbout.drawSubsection(0.0f, aboutY, (float)ofGetWidth(), (float)ofGetHeight(), 0.0f, (float)crop);
        }
        else {
            imgAbout.draw(0, aboutY, ofGetWidth(), ofGetHeight());
        }
        drawArrow(true);

        ofDisableAlphaBlending();
        ofPopStyle();
    }

    else if (appState == APP) {

        if (isOsx()) {
            currentAlpha = DEFAULT_ALPHA;
            drawArrow(true);
            ofPushStyle();
            ofSetColor(IMAGE_COLOR, DEFAULT_ALPHA);
            ofEnableAlphaBlending();
            ofDrawRectangle(barRect);
            ofDisableAlphaBlending();
            ofPopStyle();
        }
    }

}
ofxSimpleGuiControl &ofxSimpleGuiControl::setTextBGColor(bool clickable) {
	if(isMouseOver() && clickable) ofSetHexColor(config->textBGOverColor);
	else ofSetHexColor(config->textBGColor);
	return *this;
}
示例#8
0
//--------------------------------------------------------------
void ofApp::draw(){

	//we don't want to capture every frame
	//so we only capture one frame when capture
	//is set to true
	if(capture){
		output.beginEPS("test.ps");
	}

	//do we want filled shapes or outlines?
	if(bFill)output.fill();
	else output.noFill();


	//--------------------
	// some lines - lets make a grid!
	//

	int numX = ofGetWidth() / 10;
	int numY = ofGetHeight() / 10;

	output.setColor(0xEEEEEE);

	for(int y = 0; y < numY; y++){
		output.line(0, y * 10, ofGetWidth(), y * 10);
	}

	for(int x = 0; x < numX; x++){
		output.line(x * 10, 0, x * 10, ofGetHeight() );
	}


	//--------------------
	// basic shapes
	//

	//a - draw a triangle
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("a) triangle();", 65, 140);

	output.setColor(0x000000);
	output.triangle(80, 110, 110, 50, 140, 110);

	//b - rectangle from the top left corner
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("b & c) rect();\n", 220, 140);
	output.setColor(0x4d4d4d);
	output.disableCenterRect();
	output.rect(240, 50, 60, 60);

	//c - rectangle from the center
	output.setColor(0xededed);
	output.enableCenterRect();
	output.rect(270, 80, 20, 20);

	//d - circle
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("d) circle(); \n", 380, 140);
	output.setColor(0x828282);
	output.circle(425, 80, 30);

	//e - ellipse
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("e) ellipse(); \n", 520, 140);

	output.setColor(0x363636);
	output.ellipse(570, 80, 40, 30);

	//f - bezier curve - we define the start, the first control point, the second control point and the end
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("f) bezier(); \n", 70, 300);

	output.setColor(0x5c5c5c);
	output.bezier(70, 270,  100,  200, 120, 260, 180, 270);

	//lets also draw the handles
	output.setColor(0xCCCCCC);
	output.line(70, 270, 100, 200);
	output.line(180, 270, 120, 260);
	output.setColor(0xAAAAAA);
	output.enableCenterRect();
	output.rect(100, 200, 4, 4);
	output.rect(120, 260, 4, 4);


	//g - catmull curve - we give four points - the first and last are not drawn, but used to calculate the curve.
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("g) curve(); \n", 240, 300);

	output.setColor(0x7e7e7e);
	output.curve(160, 100,  240, 270,   330, 240,  360, 500);


	//h - an arc
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("h) arc(); \n", 390, 300);

	output.setColor(0x5c5c5c);
	output.arc(400, 270, 60, 0, -70);


	//i - just a line
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("i) line(); \n", 530, 300);

	output.setColor(0x5c5c5c);
	output.line(540, 220, 600, 270);




	//--------------------
	//--------------------
	//--------------------
	// advanced shapes
	// these shapes can have an unlmited number of vertices




	// -----------------------------------
	// j - polygon shape based on mouse position
	// -----------------------------------
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("j) shape w/ \npolyVertex \n", 70, 520);

	output.setColor(0x6b6b6b);
	output.beginShape();

		//set number of sides based on mouse position
		int numSteps = ( (float)mouseX / ofGetWidth() )* 12.0;

		//make sure we don't go bellow 3 sides
		numSteps = MAX(3, numSteps);


		float step		= TWO_PI / (numSteps);
		float angle		= 0.0;
		float cenX		= 110;
		float cenY		= 430;
		float radius	= 50;

		for(int i = 0; i < numSteps; i++){
			float rx = cenX + cos(angle) * radius;
			float ry = cenY + sin(angle) * radius;

			output.polyVertex(rx, ry);
			angle += step;
		}

	output.endShape(true);




	// -----------------------------------
	// k - curve shape based on mouse position
	// -----------------------------------
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("k) shape w/ \ncurveVertex \n", 290, 520);

	output.setColor(0xb8b8b8);
	output.beginShape();

		//set number of sides based on mouse position
		numSteps = ( (float)mouseX / ofGetWidth() )* 12.0;

		//make sure we don't go bellow 3 sides
		numSteps = MAX(3, numSteps);

		step		= TWO_PI / (numSteps);
		angle		= 0.0;
		cenX		= 340;
		cenY		= 430;
		radius		= 50.0;

		//we need 3 extra points to get a complete curve shape
		for(int i = 0; i < numSteps + 3; i++){
			float rx = cenX + cos(angle) * radius;
			float ry = cenY + sin(angle) * radius;

			output.curveVertex(rx, ry);
			angle += step;
		}

	output.endShape(true);



	// -----------------------------------
	// l - bezier shape based on mouse position
	// -----------------------------------
	ofSetHexColor(0xCC0000);
	ofDrawBitmapString("l) shape w/ \nbezierVertex \n", 510, 520);

	// we specify control points that shape each part of the shape
	output.setColor(0xd4d4d4);
	output.beginShape();

		//set number of sides based on mouse position
		numSteps = ( (float)mouseX / ofGetWidth() )* 12.0;

		//make sure we don't go bellow 3 sides
		numSteps = MAX(3, numSteps);

		step		= TWO_PI / (numSteps);
		angle		= 0.0;
		cenX		= 550;
		cenY		= 430.0;
		radius		= 40.0;
		float scale = 1.0 + 0.6 * sin(ofGetElapsedTimef());

		for(int i = 0; i < numSteps; i++){
			float rx = cenX + cos(angle) * radius;
			float ry = cenY + sin(angle) * radius;

			if(i == 0){
				output.polyVertex(rx, ry);
			}

			float rx2 = cenX + cos(angle+step) * radius;
			float ry2 = cenY + sin(angle+step) * radius;

			//lets make our control points in between each side and out a little way
			float cx = cenX + cos(angle + step*0.5) * radius * scale;
			float cy = cenY + sin(angle + step*0.5) * radius * scale;

			output.bezierVertex(cx, cy, cx, cy, rx2, ry2);

			angle += step;
		}

	output.endShape(true);




	//----------------------------
	//----------------------------
	//----------------------------
	// Bonuse :)
	// Mouse draw - with curved line
	//

	if( pts.size() > 0 ){

		int numPts = pts.size();

		output.setColor(0x0088EE);
		output.noFill();
		output.beginShape();

		//catmull curves create nice smooth curves between points
		//so actually a lower resolution creates a smoother line
		//and reduce the number of poiints in our eps file.
		int rescaleRes = 6;

		for(int i = 0; i < numPts; i++){

			//we need to draw the first and last point
			//twice for a catmull curve
			if(i == 0 || i == numPts -1){
				output.curveVertex(pts[i].x, pts[i].y);
			}

			if(i % rescaleRes == 0) output.curveVertex(pts[i].x, pts[i].y);
		}

		output.endShape();
	}



	//-------------------------
	//-------------------------
	// End capture!
	//

	//once we have done all our drawing
	//we end the ouput which saves the file
	//and then we stop capturing
	if(capture){
		output.endEPS();
		capture =false;
	}

	//
	// End capture!
	//-------------------------
	//-------------------------


	//we don't save this to eps - just info for the app

	ofFill();
	ofSetRectMode(OF_RECTMODE_CORNER);
	ofSetHexColor(0x000000);
	ofDrawRectangle(60, 630, 200,60);

	//some text to explain whats what
	ofSetHexColor(0xDDDDDD);
	ofDrawBitmapString("spacebar to capture\n'f' key toggles fill\nmouse to doodle", 75, 650);

}
示例#9
0
//------------------------------------------------------------------
void ui::draw(ofTrueTypeFont& basicFont) {

    ofSetColor(255, 0, 0, 100);
    ofRect(0, ofGetHeight()/3, ofGetWidth(), 5);
    
    sprintf (timeString, "time: %0.2i:%0.2i:%0.2i \nelapsed time %i", ofGetHours(), ofGetMinutes(), ofGetSeconds(), ofGetElapsedTimeMillis());
	
    ofSetHexColor(0x000000);
	basicFont.drawString(timeString, 10,ofGetHeight()-90);
	basicFont.drawString(eventString, 10,ofGetHeight()-20);
    
    ofEnableAlphaBlending();
    
    ofSetColor(170, 170, 170);
    ofRect(*pencilBox);
    ofRect(*fontBox);
    ofRect(*tableBox);
    ofRect(*okSaveBox);
    
    ofSetHexColor(0x000000);

    pencil->draw(10, 310);
    font->draw(10, 355);
    table->draw(10, 400);
    okSave->draw(10, 445);

    if (*fontSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        basicFont.drawString("text selected", ofGetWidth()/2,ofGetHeight()/3);
        
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }

    }
    
    if (*pencilSelected) {

        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        basicFont.drawString("pencil selected", ofGetWidth()/2,ofGetHeight()/3);
        
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }
        
        if (currentDrawing.size()>0) {
            for (int i = 1; i < currentDrawing.size(); i++) {
                ofLine(currentDrawing[i-1].x, currentDrawing[i-1].y, currentDrawing[i].x, currentDrawing[i].y);
            }
        }
    }
    
    if (*tableSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }
        basicFont.drawString("table selected", ofGetWidth()/2,ofGetHeight()/3);
    }

    if (*okSaveSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }

        basicFont.drawString("ok save selected", ofGetWidth()/2,ofGetHeight()/3);
    }

    
    ofDisableAlphaBlending();

}
示例#10
0
文件: Wind.cpp 项目: damiannz/wind
void Wind::drawGui()
{
		
	if ( ofGetFrameNum() > 3 )
	{
		gui.draw();

		if ( showing_image == SI_FOCUS )
		{
#ifndef NO_WINDOW
			colorImg.setROI( xoffs, yoffs, 160, 120 );
			colorImg.drawROI( 0, 0 );
			colorImg.resetROI();
#else
			WatterottScreen::get()->display888( 0, 0, 160, 120, colorImg.getPixels(), xoffs, yoffs, colorImg.getWidth()*3 );
#endif
		}
		else if ( showing_image == SI_DIFF )
		{
#ifndef NO_WINDOW
			grayDiff.draw( 0, 0, 160, 120 );
#else
			WatterottScreen::get()->display8( 0, 0, 160, 120, grayDiff.getPixels(), xoffs, yoffs, grayDiff.getWidth() );
#endif
		}
		else if ( showing_image == SI_GRAY_CONTRASTED )
		{
#ifndef NO_WINDOW
			grayImageContrasted.draw( 0, 0, 160, 120 );
#else
			WatterottScreen::get()->display8( 0, 0, 160, 120, grayImageContrasted.getPixels(), xoffs, yoffs, grayImageContrasted.getWidth() );
#endif
		}
		else if ( showing_image == SI_NONE && prev_showing_image != showing_image )
		{
#ifndef NO_WINDOW
			ofSetHexColor( 0x808080 );
			ofFill();
			ofRect( 0, 0, 160, 120 );
#else
			WatterottScreen::get()->fillRect( 0, 0, 160, 120, ofColor( 128 ) );
#endif
		}
		prev_showing_image = showing_image;
		
		
		ofFill();
		for ( int i=0; i<TINY_HEIGHT; i++ )
		{
			for ( int j=0; j<TINY_WIDTH; j++ )
			{
				ofColor c;
				c.set( tiny[i*TINY_WIDTH+j], 255 );
#ifndef NO_WINDOW
				ofSetColor( c );
				ofRect( 180+j*4, i*4, 4, 4 );
#else
				WatterottScreen::get()->fillRect( 180+j*4, i*4, 4, 4, c );
#endif

			}
		}
	}
	
}
//--------------------------------------------------------------
void ofApp::draw() {
    
    ofSetColor(255, 255, 255);
    
    if(bDrawPointCloud) {
        easyCam.begin();
        drawPointCloud();
        easyCam.end();
    } else {
        // draw from the live kinect
        kinect.drawDepth(10, 10, 400, 300);
        kinect.draw(420, 10, 400, 300);
        
        grayImage.draw(10, 320, 400, 300);
        bool pose = contourFinder.checkForChange();
        if(pose){
            posed = true;
        }
        if(posed){
            
            ofNoFill();
            ofSetHexColor(0x00FFFF);
            for( int i=0; i<(int)contourFinder.poses.size(); i++ ) {
                ofBeginShape();
                for( int j=0; j< contourFinder.poses[i].nPts; j++ ) {
                    ofVertex(  contourFinder.poses[i].pts[j].x,  contourFinder.poses[i].pts[j].y );
                }
                ofEndShape();
            }
        }
        
        
        contourFinder.draw(10, 320, 400, 300);
        //ribbon brush
        ofEnableBlendMode(OF_BLENDMODE_ALPHA);
        
        for(int i = 0; i < markings.size(); i++)
        {
            markings[i]->draw();
        }
        
        if(marking != NULL)
        {
            marking->draw();
        }
    }
    
    // draw instructions
    ofSetColor(255, 255, 255);
    stringstream reportStream;
    
    if(kinect.hasAccelControl()) {
        reportStream << "accel is: " << ofToString(kinect.getMksAccel().x, 2) << " / "
        << ofToString(kinect.getMksAccel().y, 2) << " / "
        << ofToString(kinect.getMksAccel().z, 2) << endl;
    } else {
        reportStream << "Note: this is a newer Xbox Kinect or Kinect For Windows device," << endl
        << "motor / led / accel controls are not currently supported" << endl << endl;
    }
    
    reportStream << "press p to switch between images and point cloud, rotate the point cloud with the mouse" << endl
    << "using opencv threshold = " << bThreshWithOpenCV <<" (press spacebar)" << endl
    << "set near threshold " << nearThreshold << " (press: + -)" << endl
    << "set far threshold " << farThreshold << " (press: < >) num blobs found " << contourFinder.nBlobs
    << ", fps: " << ofGetFrameRate() << endl
    << "press c to close the connection and o to open it again, connection is: " << kinect.isConnected() << endl;
    
    if(kinect.hasCamTiltControl()) {
        reportStream << "press UP and DOWN to change the tilt angle: " << angle << " degrees" << endl
        << "press 1-5 & 0 to change the led mode" << endl;
    }
    
    ofDrawBitmapString(reportStream.str(), 20, 652);
    
    //-----ribbon brush
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
    if(marking != NULL)
    {
        marking->draw();
    }
    
    for(int i = 0; i < markings.size(); i++)
    {
        markings[i]->draw();
    }
    
}
示例#12
0
//--------------------------------------------------------------
void ofApp::draw(){
    // draw to the main window
    ofSetColor(0, 255, 0);
    ofDrawBitmapString("this is the first window", 100, 100);
    ofRect(150, 190, 240, 160);
    
    // draw the second window
//    secondWindow.begin();
//    ofBackground(255);
//    ofSetColor(0, 0, 255);
//    ofDrawBitmapString("this is the second window", 100, 100);
//    ofEllipse(320, 250, 200, 200);
//    secondWindow.end();
    
    ///^^^initialise this into the areas required.
    
    
    
    ofBackground(68,158,239,0.5);
    ofSetHexColor(0xffffff);
    camera.draw(20,20);
  //  camera2.draw(50,50);
    //draw all cv images
    
    
	
    
    hsv.draw(20,280);
    filtered.draw(20,280);
    
    // then draw the contours:
    contours.draw(20,280);
    
    // Texture.draw(320,20);
    Output.draw(340,280);
    
    char tmpStr[255];
	sprintf(tmpStr, "h: %i\ns: %i\nv: %i", hue, sat, val);
	ofDrawBitmapString(tmpStr, 20, 800);
    //————————————————————–
    
    

    //    draw circles for found blobs
    for (int i=0; i<contours.nBlobs; i++) {
        
        contours.blobs[i].draw(340,280);
        ofSetColor(0,255,0);
		
        ofRect(
               contours.blobs[i].boundingRect.getCenter().x,
               contours.blobs[i].boundingRect.getCenter().y,20,20);
    
    }
    //    //finding the center of the blob and where it is in relation to the center of the vectors.
  
    for(int i = 0; i < contours.blobs.size(); i ++) {
     //  if (trigger==true)  {
        position.x = contours.blobs[0].centroid.x;
        position.y=  contours.blobs[0].centroid.y;
   //  trigger=false;
   //     }
    }

    
    
    ofCircle(position.x, position.y, 10);
    
    
    // finally, a report:
	ofSetHexColor(0xffffff);
	stringstream reportStr;
	reportStr << "bg subtraction and blob detection" << endl
    << "press ' ' to capture bg" << endl
    << "threshold " << threshold << " (press: +/-)" << endl
    << "num blobs found " << contours.nBlobs << ", fps: " << ofGetFrameRate();
	ofDrawBitmapString(reportStr.str(), 20, 600);
    
    //imagesequencecode
    int frameIndex = closestVec; //was set to zero
    // we need some images if not return
    if((int)images.size() <= 0) {
        ofSetColor(255);
        ofDrawBitmapString("No Images...", 150, ofGetHeight()/2);
        return;
    }
    // draw the second window
    secondWindow.begin();
    ofBackground(255);
    ofSetColor(0, 0, 255);
    ofDrawBitmapString("this is the second window", 100, 100);
   // ofEllipse(320, 250, 200, 200);
   

    // draw the image sequence at the new frame count
    ofSetColor(255);
    images[frameIndex].draw(0,0,1024, 768);
    
    secondWindow.end();
    
    // draw where we are in the sequence
    float x = 0;
    for(int offset = 0; offset < 5; offset++) {
        int i = (frameIndex + offset) % images.size();
        ofSetColor(255);
        images[i].draw(720+x, 540, 240, 160);
        x += 160;
    }
    
    
    // how fast is the app running and some other info
    ofSetColor(50);
    ofRect(720, 920, 200, 200);
    ofSetColor(200);
    string info;
    info += ofToString(frameIndex)+" sequence index\n";
    info += ofToString(appFPS)+"/"+ofToString(ofGetFrameRate(), 0)+" fps\n";
    info += ofToString(sequenceFPS)+" Sequence fps\n\n";
    info += "Keys:\nup & down arrows to\nchange app fps\n\n";
    info += "left & right arrows to\nchange sequence fps";
    info += "\n\n't' to toggle\nframe independent("+ofToString(bFrameIndependent)+")";
    
    ofDrawBitmapString(info, 1420, 30);
    
    
    
}
示例#13
0
void ofxCamMapper::drawPanel(int x,int y){
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	ofPushMatrix();
	ofTranslate(x, y);
	
	//カメラポジションの描画
	ofSetHexColor(0xFFFFFF);
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	
	ofPushMatrix();
	ofTranslate(camWin_pos.x,camWin_pos.y);
	//camera.draw(0,0, camWin_pos.width, camWin_pos.height);
	for (int i = 0;i < cam_pts.size();i++){
		ofPoint draw_pt = ofPoint(cam_pts[i].x/CAM_WIDTH*camWin_pos.width,
								  cam_pts[i].y/CAM_HEIGHT*camWin_pos.height);
		if (i >= (*out_pts).size()){
			ofLine(draw_pt.x-3, draw_pt.y, draw_pt.x+3, draw_pt.y);
			ofLine(draw_pt.x, draw_pt.y-3, draw_pt.x, draw_pt.y+3);			
		}
	}
	ofPopMatrix();
	
	main_scroll.set(MAX(0,MIN(ofGetMouseX(),BUFFER_WIDTH-1024.0)),
					MAX(0,MIN(ofGetMouseY(),BUFFER_HEIGHT-768)));
	
	
	//メインアウトポジションの描画
	ofSetHexColor(0xFFFFFF);
	ofPushMatrix();
	ofTranslate(vert_child.drawArea.x,vert_child.drawArea.y);
	if (vert_child.enableScroll){
		Buffer_out.getTextureReference().bind();
		glBegin(GL_TRIANGLE_STRIP);
		glTexCoord2f(vert_child.sclPt.x,vert_child.sclPt.y);
		glVertex2f(0, 0);
		glTexCoord2f(vert_child.sclPt.x+vert_child.drawArea.width,vert_child.sclPt.y);
		glVertex2f(vert_child.drawArea.width, 0);
		glTexCoord2f(vert_child.sclPt.x,vert_child.sclPt.y+vert_child.drawArea.height);
		glVertex2f(0, vert_child.drawArea.height);
		glTexCoord2f(vert_child.sclPt.x+vert_child.drawArea.width,vert_child.sclPt.y+vert_child.drawArea.height);
		glVertex2f(vert_child.drawArea.width,vert_child.drawArea.height);
		glEnd();
		Buffer_out.getTextureReference().unbind();
	}else{
		Buffer_out.draw(0, 0,vert_child.drawArea.width,vert_child.drawArea.height);
	}
	if (drawChild){
		vert_child.draw();
	}
	ofPopMatrix();

	//ソースポジションの描画
	ofSetHexColor(0xFFFFFF);
	ofPushMatrix();
	ofTranslate(src_editor.drawArea.x,src_editor.drawArea.y);
	if (src_editor.enableScroll){
		Buffer_src.getTextureReference().bind();
		glBegin(GL_TRIANGLE_STRIP);
		glTexCoord2f(src_editor.sclPt.x,src_editor.sclPt.y);
		glVertex2f(0, 0);
		glTexCoord2f(src_editor.sclPt.x+src_editor.drawArea.width,src_editor.sclPt.y);
		glVertex2f(src_editor.drawArea.width, 0);
		glTexCoord2f(src_editor.sclPt.x,src_editor.sclPt.y+src_editor.drawArea.height);
		glVertex2f(0, src_editor.drawArea.height);
		glTexCoord2f(src_editor.sclPt.x+src_editor.drawArea.width,src_editor.sclPt.y+src_editor.drawArea.height);
		glVertex2f(src_editor.drawArea.width,src_editor.drawArea.height);
		glEnd();
		Buffer_src.getTextureReference().unbind();
	}else{
		Buffer_src.draw(0, 0,src_editor.drawArea.width,src_editor.drawArea.height);
	}
	for (int i = 0;i < src_pts.size();i++){
		ofCircle(src_pts[i].x, src_pts[i].y, 3);
	}
	ofPopMatrix();
	if (drawChild){
		src_editor.draw();
	}
	ofPopMatrix();
	
	
	//マスクの描画
	ofSetHexColor(0xFFFFFF);
	ofPushMatrix();
	ofTranslate(mask.drawArea.x, mask.drawArea.y);
	if (mask.enableScroll){
		Buffer_out.getTextureReference().bind();
		glBegin(GL_TRIANGLE_STRIP);
		glTexCoord2f(mask.sclPt.x,mask.sclPt.y);
		glVertex2f(0, 0);
		glTexCoord2f(mask.sclPt.x+mask.drawArea.width,mask.sclPt.y);
		glVertex2f(mask.drawArea.width, 0);
		glTexCoord2f(mask.sclPt.x,mask.sclPt.y+mask.drawArea.height);
		glVertex2f(0, mask.drawArea.height);
		glTexCoord2f(mask.sclPt.x+mask.drawArea.width,mask.sclPt.y+mask.drawArea.height);
		glVertex2f(mask.drawArea.width,mask.drawArea.height);
		glEnd();
		Buffer_out.getTextureReference().unbind();
	}
	if (drawChild){
		mask.draw();		
	}
	ofPopMatrix();
	
	//キャリブレーション表示
	ofPushMatrix();
	ofTranslate(BUFFER_WIDTH, 0);
	ofSetColor(sampleColor);
	ofRect(0, 480, 40, 40);
	ofSetColor(trackingColor);
	ofRect(40, 480, 40, 40);
	string info = "";
	info += "Score: " + ofToString(color_score) + "/" + ofToString(Genframe) + "\n";
	info += "Size:" + ofToString(size) + "\n";
	info += "Elapsed:" + ofToString(ofGetElapsedTimeMillis() - calib_waiter) + "\n";
	
	ofDrawBitmapString(info, 10,540);
	
	if ((abs(trackingColor.r - sampleColor.r) < 100)&&
		(abs(trackingColor.g - sampleColor.g) < 100)&&
		(abs(trackingColor.b - sampleColor.b) < 100)){
		ofNoFill();
		ofSetHexColor(0xFFFFFF);
		ofRect(0, 480, 80, 40);
		ofFill();
	}
	ofPopMatrix();
	menu.draw();
	ofSetHexColor(0xFFFF00);
	ofLine(SelectedPt.x-5, SelectedPt.y, SelectedPt.x+5, SelectedPt.y);
	ofLine(SelectedPt.x, SelectedPt.y-5, SelectedPt.x, SelectedPt.y+5);
	
	vector<string> PresetBranch;
	PresetBranch.push_back("Msk_Preset0");
	PresetBranch.push_back("Msk_Preset1");
	PresetBranch.push_back("Msk_Preset2");
	PresetBranch.push_back("Msk_Preset3");
	PresetBranch.push_back("Msk_Preset4");
	PresetBranch.push_back("Msk_Preset5");
	PresetBranch.push_back("Msk_Preset6");
	PresetBranch.push_back("Msk_Preset7");
	PresetBranch.push_back("Msk_Preset8");
	PresetBranch.push_back("Msk_Preset9");
	mask.menu.UnRegisterMenu("Save");
	mask.menu.RegisterBranch("Save", &PresetBranch);
}
示例#14
0
void ofxCamMapper::gen_Pts(){
	//キャリブレーションセクション
	if (bGen_Mapping){
		if (Genframe == -1){//Initialize
			phase_x = 0;
			phase_y = 1;
			calib_next = false;
			
			currentPts = (*out_pts).size();
			
			phase = phase_x;
			head = 0;
			size = BUFFER_WIDTH;
			
			color_score = 0;
			Genframe = 0;
			calib_waiter = ofGetElapsedTimeMillis();
		}
		
		/*-------------------動的なキャリブレーションの処理------------*/
		//----------------パターンの描画
		Buffer_out.begin();
		glClearColor(0, 0, 0, 1.0);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		ofSetRectMode(OF_RECTMODE_CORNER);
		ofSetColor(pattern_color);
		if (phase == phase_x){
			ofRect(head+size/2*calib_next, 0, size/2, BUFFER_HEIGHT);
		}
		if (phase == phase_y){
			ofRect(0,head+size/2*calib_next,BUFFER_WIDTH,size/2);
		}
		Buffer_out.end();
		
		
		//--------------カラーの比較・評価
		if ((ofGetElapsedTimeMillis() - calib_waiter) > calib_lateMs){
			trackingColor = getProjectionColor(cam_pts[currentPts]);
			if ((abs(trackingColor.r - sampleColor.r) < 60)&&
				(abs(trackingColor.g - sampleColor.g) < 60)&&
				(abs(trackingColor.b - sampleColor.b) < 60)){
				color_score++;
			}
			Genframe++;
		}
		
		//--------------比較を終了・データまとめて評価開始
		static int endChecker = 0,endCounter;
		if ((ofGetElapsedTimeMillis() - calib_waiter) > calib_waitMs+calib_lateMs){
			if ((color_score / (float)Genframe) > 0.3){
				if (!calib_next){
					size = MAX(1,size/2);
				}else{
					head = head+size/2;
					size = MAX(1,size/2);
					calib_next = false;
				}
			}else{
				if (!calib_next){
					calib_next = true;
				}else{
					head += size/3;
					calib_next = false;
				}
			}
			if (size != endChecker){
				endCounter = 0;
			}else{
				endCounter++;
			}
			endChecker = size;
			if (endCounter > 5){
				endCounter = 0;
				endChecker = 0;
				if (phase == phase_x){
					phase = phase_y;
					answer.x = head+size;
					head = 0;
					size = BUFFER_HEIGHT;
				}else{
					answer.y = head+size/2;
					currentPts++;
					
					(*out_pts).push_back(answer);
					src_editor.sync_Pts(-1);
					
					if (currentPts >= cam_pts.size()){
						bGen_Mapping = false;
					}
					phase = phase_x;
					head = 0;
					size = BUFFER_WIDTH;
					color_score = 0;
					Genframe = 0;
					calib_waiter = ofGetElapsedTimeMillis();
				}
			}
			Genframe = 0;
			color_score = 0;
			calib_waiter = ofGetElapsedTimeMillis();
		}
		
	}else{
		Buffer_out.begin();
		glClearColor(0, 0, 0, 1.0);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		ofSetColor(pattern_color);
		if ((*out_pts).size() == 0)
		{
			ofRect(0, 0, BUFFER_WIDTH, BUFFER_HEIGHT);
			Buffer_out.end();
		}else {
			
			ofSetHexColor(0xFFFFFF);
			Buffer_src.getTextureReference().bind();
			for (int i = 0;i < src_editor.tris.size();i++){
				glBegin(GL_TRIANGLE_STRIP);
				for (int j = 0;j < 3;j++){
					glTexCoord2f(src_editor.pts[src_editor.tris[i].idx[j]].x, 
								 src_editor.pts[src_editor.tris[i].idx[j]].y);
					glVertex2f(vert_child.pts[vert_child.tris[i].idx[j]].x,
							   vert_child.pts[vert_child.tris[i].idx[j]].y);
				}
				glEnd();
			}
			Buffer_src.getTextureReference().unbind();
			Buffer_out.end();
			
			if (inverse_affine){
				for (int i = 0;i < src_editor.rects.size();i++){
					pers_rectangle pr;
					pers_rectangle_invert pri;
					
					for (int j = 0;j < 4;j++){
						pr.srcp[j]  = src_editor.pts[src_editor.rects[i].idx[j]] / ofPoint(BUFFER_WIDTH,BUFFER_HEIGHT);
						pr.pts[j]   = vert_child.pts[src_editor.rects[i].idx[j]] / ofPoint(BUFFER_WIDTH,BUFFER_HEIGHT);
						pri.srcp[j]  = src_editor.pts[src_editor.rects[i].idx[j]] / ofPoint(BUFFER_WIDTH,BUFFER_HEIGHT);
						pri.pts[j]   = src_editor.pts[src_editor.rects[i].idx[j]] / ofPoint(BUFFER_WIDTH,BUFFER_HEIGHT);
					}
					pri.pts[0] = ofPoint(0,0);
					pri.pts[1] = ofPoint(1,0);
					pri.pts[2] = ofPoint(1,1);
					pri.pts[3] = ofPoint(0,1);
					
					pr.srcp[0] = ofPoint(0,0);
					pr.srcp[1] = ofPoint(1,0);
					pr.srcp[2] = ofPoint(1,1);
					pr.srcp[3] = ofPoint(0,1);
					
					//逆行列の計算する
					Buffer_invert.begin();
					ofClear(0, 0, 0);
					Buffer_src.getTextureReference().bind();
					glPushMatrix();
					pri.setMatrix(BUFFER_WIDTH, BUFFER_HEIGHT);
					glBegin(GL_TRIANGLE_STRIP);
					
					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[0]].x,
								 src_editor.pts[src_editor.rects[i].idx[0]].y);
					glVertex2f(src_editor.pts[src_editor.rects[i].idx[0]].x,
							   src_editor.pts[src_editor.rects[i].idx[0]].y);

					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[1]].x,
								 src_editor.pts[src_editor.rects[i].idx[1]].y);
					glVertex2f(src_editor.pts[src_editor.rects[i].idx[1]].x,
							   src_editor.pts[src_editor.rects[i].idx[1]].y);

					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[3]].x,
								 src_editor.pts[src_editor.rects[i].idx[3]].y);
					glVertex2f(src_editor.pts[src_editor.rects[i].idx[3]].x,
							   src_editor.pts[src_editor.rects[i].idx[3]].y);

					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[2]].x,
								 src_editor.pts[src_editor.rects[i].idx[2]].y);
					glVertex2f(src_editor.pts[src_editor.rects[i].idx[2]].x,
							   src_editor.pts[src_editor.rects[i].idx[2]].y);

					glEnd();
					
					glPopMatrix();
					Buffer_src.getTextureReference().unbind();
					Buffer_invert.end();
					
					//インバースから引っ張ってくる
					Buffer_out.begin();
					Buffer_invert.getTextureReference().bind();
					glPushMatrix();
					pr.setMatrix(BUFFER_WIDTH, BUFFER_HEIGHT);
					glBegin(GL_TRIANGLE_STRIP);
					
					glTexCoord2f(0,0);
					glVertex2f  (0,0);
					
					glTexCoord2f(BUFFER_WIDTH,0);
					glVertex2f  (BUFFER_WIDTH,0);
					
					glTexCoord2f(0,BUFFER_HEIGHT);
					glVertex2f  (0,BUFFER_HEIGHT);

					glTexCoord2f(BUFFER_WIDTH,BUFFER_HEIGHT);
					glVertex2f  (BUFFER_WIDTH,BUFFER_HEIGHT);
					
					glEnd();
					glPopMatrix();
					Buffer_invert.getTextureReference().unbind();
					Buffer_out.end();
				}	
			}else{
				for (int i = 0;i < src_editor.rects.size();i++){
					Buffer_out.begin();
					Buffer_src.getTextureReference().bind();
					pers_rectangle pr;
					for (int j = 0;j < 4;j++){
						pr.srcp[j] = src_editor.pts[src_editor.rects[i].idx[j]] / ofPoint(BUFFER_WIDTH,BUFFER_HEIGHT);
						pr.pts[j]  = vert_child.pts[src_editor.rects[i].idx[j]] / ofPoint(BUFFER_WIDTH,BUFFER_HEIGHT);
					}
					glPushMatrix();
					pr.setMatrix(BUFFER_WIDTH, BUFFER_HEIGHT);
					glBegin(GL_QUADS);
					
					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[0]].x,
								 src_editor.pts[src_editor.rects[i].idx[0]].y);
					glVertex2f(0,0);
					
					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[1]].x,
								 src_editor.pts[src_editor.rects[i].idx[1]].y);
					glVertex2f(BUFFER_WIDTH,0);
					
					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[2]].x,
								 src_editor.pts[src_editor.rects[i].idx[2]].y);
					glVertex2f(BUFFER_WIDTH,BUFFER_HEIGHT);
					
					glTexCoord2f(src_editor.pts[src_editor.rects[i].idx[3]].x,
								 src_editor.pts[src_editor.rects[i].idx[3]].y);
					glVertex2f(0,BUFFER_HEIGHT);
					
					glEnd();
					glPopMatrix();
					Buffer_src.getTextureReference().unbind();
					Buffer_out.end();
				}
			}
			Buffer_out.begin();
//			ofSetHexColor(0x0);
            ofDisableAlphaBlending();
            glColor4f(0.0, 0.0, 0.0, 0.0);
			for (int i = 0;i < mask.rects.size();i++){
				glBegin(GL_TRIANGLE_STRIP);
				glVertex2f(mask.pts[mask.rects[i].idx[0]].x,
						   mask.pts[mask.rects[i].idx[0]].y);
				glVertex2f(mask.pts[mask.rects[i].idx[1]].x,
						   mask.pts[mask.rects[i].idx[1]].y);
				glVertex2f(mask.pts[mask.rects[i].idx[3]].x,
						   mask.pts[mask.rects[i].idx[3]].y);
				glVertex2f(mask.pts[mask.rects[i].idx[2]].x,
						   mask.pts[mask.rects[i].idx[2]].y);
				glEnd();
			}
			for (int i = 0;i < mask.tris.size();i++){
				glBegin(GL_TRIANGLE_STRIP);
				glVertex2f(mask.pts[mask.tris[i].idx[0]].x,
						   mask.pts[mask.tris[i].idx[0]].y);
				glVertex2f(mask.pts[mask.tris[i].idx[1]].x,
						   mask.pts[mask.tris[i].idx[1]].y);
				glVertex2f(mask.pts[mask.tris[i].idx[2]].x,
						   mask.pts[mask.tris[i].idx[2]].y);
				glEnd();
			}
			Buffer_out.end();
            ofEnableAlphaBlending();
		}
		ofSetHexColor(0xFFFFFF);
//		for (int i = 0;i < (*out_pts).size();i++){
//			ofNoFill();
//			ofSetHexColor(0xFF0000);
//			ofCircle((*out_pts)[i].x, (*out_pts)[i].y, 14);
//			ofSetHexColor(0xFFFFFF);
//			ofCircle((*out_pts)[i].x, (*out_pts)[i].y, 7);
//			ofLine((*out_pts)[i].x-5, (*out_pts)[i].y, (*out_pts)[i].x+5, (*out_pts)[i].y);
//			ofLine((*out_pts)[i].x, (*out_pts)[i].y-5, (*out_pts)[i].x, (*out_pts)[i].y+5);
//			ofFill();
//		}
		Buffer_out.begin();
		if (drawChild) {
			vert_child.buffer.draw(0, 0,BUFFER_WIDTH,BUFFER_HEIGHT);
            ofEnableBlendMode(OF_BLENDMODE_ALPHA);
			ofSetHexColor(0x0);
			for (int i = 0;i < mask.rects.size();i++){
				glBegin(GL_TRIANGLE_STRIP);
				glVertex2f(mask.pts[mask.rects[i].idx[0]].x,
						   mask.pts[mask.rects[i].idx[0]].y);
				glVertex2f(mask.pts[mask.rects[i].idx[1]].x,
						   mask.pts[mask.rects[i].idx[1]].y);
				glVertex2f(mask.pts[mask.rects[i].idx[3]].x,
						   mask.pts[mask.rects[i].idx[3]].y);
				glVertex2f(mask.pts[mask.rects[i].idx[2]].x,
						   mask.pts[mask.rects[i].idx[2]].y);
				glEnd();
			}
			for (int i = 0;i < mask.tris.size();i++){
				glBegin(GL_TRIANGLE_STRIP);
				glVertex2f(mask.pts[mask.tris[i].idx[0]].x,
						   mask.pts[mask.tris[i].idx[0]].y);
				glVertex2f(mask.pts[mask.tris[i].idx[1]].x,
						   mask.pts[mask.tris[i].idx[1]].y);
				glVertex2f(mask.pts[mask.tris[i].idx[2]].x,
						   mask.pts[mask.tris[i].idx[2]].y);
				glEnd();
			}
		}
		Buffer_out.end();
	}
}