示例#1
0
//--------------------------------------------------------------
void testApp::draw(){
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	ofSetColor(0, 0, 0, 63);
	ofRect(0, 0, ofGetWidth(), ofGetHeight());
    
	ofSetColor(255, 255, 255);
	for (int i = 0; i < springs.size(); i++){
		springs[i].draw();
	}
	ofSetColor(31, 127, 255);
	for (int i = 0; i < particles.size(); i++){
		particles[i].draw();
	}

}
示例#2
0
//--------------------------------------------------------------
void testApp::setup(){
	ofBackground(0, 0, 0);
	ofSetVerticalSync(true);
	ofSetFrameRate(30);
	ofSetRectMode(OF_RECTMODE_CENTER);
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	
	oscRecv.setup(12345);
	
	rotationVelocity.set(ofRandomf()*0.5, ofRandomf()*0.5, ofRandomf()*0.5);
	rotation.set(0, 0, 0);

	oscVars.addParam("/rotation", rotation);
	oscVars.addParam("/rotationVelocity", rotationVelocity);
}
示例#3
0
//-------------------------------------------------
void itemSelector::draw()
{
	if(!_startCheck)
	{
		return;
	}

	ofPushStyle();
	ofEnableBlendMode(ofBlendMode::OF_BLENDMODE_ADD);
	ofSetColor(255);
	{
		_itemSelector.draw(_pos);
	}
	ofPopStyle();
}
示例#4
0
	void ftParticleFlow::update(float _deltaTime) {
		float time = ofGetElapsedTimef();
		if (_deltaTime != 0)
			deltaTime = _deltaTime;
		else
			deltaTime = time - lastTime;
		lastTime = time;
		timeStep = deltaTime * speed.get();
		
		if (bIsActive.get()) {
			
			ofPushStyle();
			ofEnableBlendMode(OF_BLENDMODE_DISABLED);
			
			
			ALMSParticleShader.update(*particleAgeLifespanMassSizeSwapBuffer.getBuffer(),
									   particleAgeLifespanMassSizeSwapBuffer.getBackTexture(),
									   particlePositionSwapBuffer.getBackTexture(),
									   flowVelocitySwapBuffer.getBackTexture(),
									   densitySwapBuffer.getBackTexture(),
									   obstacleBuffer.getTexture(),
									   deltaTime,
									   birthChance.get(),
									   birthVelocityChance.get(),
									   lifeSpan.get(), lifeSpanSpread.get(),
									   mass.get(), massSpread.get(),
									   size.get(), sizeSpread.get());
			particleAgeLifespanMassSizeSwapBuffer.swap();
			
		

			moveParticleShader.update(*particlePositionSwapBuffer.getBuffer(),
									  particlePositionSwapBuffer.getBackTexture(),
									  particleAgeLifespanMassSizeSwapBuffer.getBackTexture(),
									  fluidVelocitySwapBuffer.getBackTexture(),
									  particleHomeBuffer.getTexture(),
									  timeStep,
									  cellSize.get());
			particlePositionSwapBuffer.swap();
			
			ofPopStyle();
	 
			flowVelocitySwapBuffer.clear();
			fluidVelocitySwapBuffer.clear();
			densitySwapBuffer.clear();
			obstacleBuffer.clear();
		}
	}
//--------------------------------------------------------------
void testApp::draw(){

    ofBackground(0, 0, 0);
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    
    //FBO - Invert Color
    lastScreen.begin();
    
        ofBackground(0, 0, 0, 0);
        
        //ofSetColor(255, 255, 255);
        if (modeType == 0 || modeType == 2 || modeType == 5 || modeType == 6 || modeType == 7 ) {
            //cout << "draw" <<endl;
            binaries.draw();
        }
        if (modeType == 1) {
            noteScores.draw();
        }
        
        if (modeType == 3) {
            particles.draw();
        }
    
    lastScreen.end();
    
    glDisable(GL_DEPTH_TEST);
    ofDisableAlphaBlending();
    ofSetColor(255, 255, 255,255);
    if (invertMode == 1) {
        invert.begin();
        //invert.setUniform1f("num", ofMap(mouseX, 0, ofGetWidth(), 0.0, 1.0));
        lastScreen.draw(0, 0);
        invert.end();
    }else{
    
    lastScreen.draw(0, 0);
    
    }
    
    //END - Black Out the Whole Screen
    if (modeType == 4) {
        ofSetColor(0, 0, 0);
        ofRect(0, 0, ofGetWidth(), ofGetHeight());
    }

    
}
示例#6
0
//--------------------------------------------------------------
void testApp::setup()
{
    
    //ofSetWindowShape(ofGetScreenWidth(), ofGetScreenHeight());
    ofToggleFullscreen();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    
    img.loadImage("texture2.png");
    hue = 0;
    bri = 150;
    ofHideCursor();
    
    //sequencer setup
    sender.setup("localhost", 6534);
    recvr.setup(6666);
    circle.set(ofGetWidth()/2, ofGetHeight()/2);
    rotation = 0;
    
    //Set the background to black
    ofBackground( 0 , 0 , 0 ) ; 
  
    //Loop through all the rows
    for ( float i = 0 ; i < 360 ; i += 0.2)
    {
        
        ofColor color = ofColor::fromHsb(hue, 255, bri);
        //red pixel
            //color.g = pixels[index+1] ;     //blue pixel
            //color.b = pixels[index+2] ;     //green pixel
            int tempRadius = ofRandom(130, 150);
            int x = ofGetWidth()/2 + cos(i)*150;
            int y = ofGetHeight()/2 + sin(i)*150;
        
            particles.push_back( Particle ( ofPoint ( x, y ) , color) ) ;
    }
    
    ofSetFrameRate( 30 ) ; 
    numParticles = particles.size() ;

    
    //Set spring and sink values
    cursorMode = 0 ; 
    forceRadius = 45 ; 
    friction = 0.85 ; 
    springFactor = 0.12 ; 
    springEnabled = true ;
    inc = 2;
}
示例#7
0
void KinectScene2::drawFlowfield()
{
	float reScale = (float) parentApp->getRenderWidth() / parentApp->kinectWidth;

	// center and reScale from Kinect to custom dimensions
	ofTranslate(0, (parentApp->getRenderHeight() - parentApp->kinectHeight*reScale)/2);
	ofScale(reScale,reScale,reScale);

	// set global variables that influence the particle flow's movement
	globalX = ofNoise(ofGetFrameNum() * 0.01) * parentApp->getRenderWidth()/2 + parentApp->getRenderWidth()/4;
	globalY = ofNoise(ofGetFrameNum() * 0.005 + 5) * parentApp->getRenderHeight();
	
	// update and display all particles in the flow
	//if(contour.size() > 3) 
	{
		float w = parentApp->kinectWidth;
		float h = parentApp->kinectHeight;

		for (int i = 0; i < flow.size(); i++) 
		{
			flow.at(i).update(globalX,globalY,w,h,contour);
			flow.at(i).updateVertexArrays(w, h, i, posArray, colArray);
		}

		ofPushStyle();
		ofEnableBlendMode(OF_BLENDMODE_ADD);

		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(2, GL_FLOAT, 0, posArray);
	
		glEnableClientState(GL_COLOR_ARRAY);
		glColorPointer(3, GL_FLOAT, 0, colArray);
	
		glDrawArrays(GL_LINES, 0, MAX_PARTICLES * 2);
	
		glDisableClientState(GL_VERTEX_ARRAY);
		glDisableClientState(GL_COLOR_ARRAY);

		ofPopStyle();


	}


	// set the colors randomly every 240th frame
	//setRandomColors(240);

}
void testApp::drawVideo() {
    
  big->draw( ofGetWidth(), 0, -ofGetWidth(), ofGetHeight() );
    
  if ( drawOverlayImage ) {
    ofPushStyle();
    ofEnableBlendMode( OF_BLENDMODE_ALPHA );
    ofSetColor( 255, (int)(255*overlayImageOpacity) );
    overlayImage.draw( 0, 0 );
    ofPopStyle();
  }
    
  crawl.draw();
  voteDisplay.draw();

}
示例#9
0
//---------------------------------------------------------------------
void kuButton::draw() {
    if ( visible_ ) {
        ofColor mainColor = ( enabled_ ) ? ofColor( 255 ) : ofColor( 128 );
        ofSetColor( mainColor );
        icon_.draw(X_, Y_);
        
        if ( down_ || state_ ) {
            ofColor overColor = ( state_ ) ? ofColor( 160 ) : ofColor( 128 );
            ofSetColor( overColor );
            ofFill();
            ofEnableBlendMode( OF_BLENDMODE_ADD );
            ofRect( X_, Y_, W_, H_ );
            ofEnableAlphaBlending();
        }
    }
}
示例#10
0
//--------------------------------------------------------------
void testApp::draw()
{    
	ofBackground(red, green, blue, 255); 
	
	ofPushStyle(); 
	ofEnableBlendMode(OF_BLENDMODE_ALPHA); 


	if(bdrawGrid)
	{
		ofSetColor(255, 255, 255, 25);	
		drawGrid(8,8); 
	}
    
	ofPopStyle(); 
}
//------------------------------------------------------------------
void demoParticle::draw(ofImage* _imagen){

	if (hCycle < 255) hCycle += 0.01;
	else hCycle = 0;

	color.setHue(hCycle);
	color.setHsb(hCycle, 255, 255);

    ofSetColor(color);
    ofPushStyle();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
	_imagen->draw( pos.x, pos.y, scale * 12, scale * 12);
	ofDisableBlendMode();
	ofPopStyle();

}
示例#12
0
文件: testApp.cpp 项目: egelor/ofxSPK
//--------------------------------------------------------------
void testApp::draw()
{
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	
	cam.begin();

	ofEnableAlphaBlending();
	sys.draw();

	em.draw();
	
	mod.draw();
	mod2.draw();

	cam.end();
}
示例#13
0
//--------------------------------------------------------------
void testApp::setup(){
	
	ofSetVerticalSync(true);
	ofSetFrameRate(60);
	
	ofBackground(0);
	
    ofEnableAlphaBlending();
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	
	// set up all the different modes
	mode1.setup();
	mode2.setup();
	mode3.setup();
	
	useNori = true;
	appRunning = false;
	
	// set up fbos for each mode
	fbo1.allocate(ofGetWidth(), ofGetHeight());
	fbo2.allocate(ofGetWidth(), ofGetHeight());
	fbo3.allocate(ofGetWidth(), ofGetHeight());
	
	fbo2.begin();
	ofClear(255, 255, 255, 0);
	fbo2.end();

	// set up common FFT stuff

    // 0 output channels,
	// 2 input channels
	// 44100 samples per second
	// BUFFER_SIZE samples per buffer
	// 4 num buffers (latency)
	//ofSoundStreamSetup(0, 2, this, 44100, BUFFER_SIZE, 4);
	ofSoundStreamSetup(2, 4, this, 44100, BUFFER_SIZE, 4);
	
	FFTanalyzer.setup(44100, BUFFER_SIZE/2, 2);
	FFTanalyzer.peakHoldTime = 15; // hold longer
	FFTanalyzer.peakDecayRate = 0.8f; // decay slower
	FFTanalyzer.linearEQIntercept = 0.9f; // reduced gain at lowest frequency
	FFTanalyzer.linearEQSlope = 0.01f; // increasing gain at higher frequencies

	// set up syphon server
	syphon.setName("hands");

}
示例#14
0
//--------------------------------------------------------------
void testApp::setup()
{
    ofSetFrameRate(60);
    ofSetLogLevel(OF_LOG_VERBOSE);
    background.allocate(1024,768,OF_IMAGE_COLOR);
    background.loadImage("background.png");
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);

    imageSequence.init("volumes/head/cthead-8bit",3,".tif", 1);
    volWidth = imageSequence.getWidth();
    volHeight = imageSequence.getHeight();
    volDepth = imageSequence.getSequenceLength();

    cout << "setting up volume data buffer at " << volWidth << "x" << volHeight << "x" << volDepth <<"\n";

    volumeData = new unsigned char[volWidth*volHeight*volDepth*4];

    for(int z=0; z<volDepth; z++)
    {
        imageSequence.loadFrame(z);
        for(int x=0; x<volWidth; x++)
        {
            for(int y=0; y<volHeight; y++)
            {
                // convert from greyscale to RGBA, false color
                int i4 = ((x+volWidth*y)+z*volWidth*volHeight)*4;
                int sample = imageSequence.getPixels()[x+y*volWidth];
                ofColor c;
                c.setHsb(sample, 255-sample, sample);

                volumeData[i4] = c.r;
                volumeData[i4+1] = c.g;
                volumeData[i4+2] = c.b;
                volumeData[i4+3] = sample;
            }
        }
    }

    myVolume.setup(volWidth, volHeight, volDepth, ofVec3f(1,1,2),true);
    myVolume.updateVolumeData(volumeData,volWidth,volHeight,volDepth,0,0,0);
    myVolume.setRenderSettings(1.0, 1.0, 0.75, 0.1);

    linearFilter = false;

    cam.setDistance(1000);
    cam.enableMouseInput();
}
示例#15
0
文件: ofApp.cpp 项目: Mana-Hanno/oF
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetFrameRate(60);
    ofSetVerticalSync(true);
    ofBackgroundHex(0x000000);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
 
    box2d.init();
    box2d.setGravity(0, 0);
    box2d.setFPS(30.0);
    
    particleImage.loadImage("emitter.png");
    dacImage.loadImage("particle.png");
    
    dac.fixture.filter.groupIndex = -1;
    dac.setup(box2d.getWorld(), ofGetWidth()/2, ofGetHeight()/2, 1,1);

}
示例#16
0
//--------------------------------------------------------------
void ofApp::setup(){
    //画面の基本設定
    ofBackground(0, 0, 0);
    ofEnableAlphaBlending();
    ofSetFrameRate(60);
    
    //カメラ使用の場合
#ifdef _USE_LIVE_VIDEO
    //カメラから映像を取り込んで表示
    vidGrabber.setVerbose(true);
    vidGrabber.initGrabber(W,H);
#else
    //カメラ不使用の場合ムービーファイルを読み込んで再生
    vidPlayer.loadMovie("fingers.mov");
    vidPlayer.play();
#endif
    
    //使用する画像の領域を確保
    colorImg.allocate(W,H);
    grayImage.allocate(W,H);
    grayBg.allocate(W,H);
    grayDiff.allocate(W,H);
    
    //変数の初期化
    bLearnBakground = true;
    showCvAnalysis = false;
    threshold = 20;
    videoMode = 0;
    
    
    //AudoVisualizer
    
    ofSetCircleResolution(100);
    
    mySound.loadSound("sample.mp3"); //サウンドファイルの読込み
    mySound.setLoop(true); //ループ再生をONに
    mySound.play();
    
    elapsedTime=0;//経過時間を初期化
    
    int bufferSize = 256;//bufferSizeを256に設定
    left.assign(bufferSize, 0.0);//ベクトルの大きさをbufferSize、成分を0.0とする(まずは初期化)
    soundStream.setup(this, 0, 2, 44100, bufferSize, 4);//設定した引数でストリームを開始します。
    
    ofEnableBlendMode(OF_BLENDMODE_ADD);//加算合成
}
示例#17
0
文件: ofApp.cpp 项目: tado/FM14New
//--------------------------------------------------------------
void ofApp::draw(){
    ofxUIIntSlider *m = (ofxUIIntSlider *)gui->getWidget("MIX");

    srcMix = oscControl->controlVal[0] * 2;

    ofSetColor(srcMix);
    blackmagic->drawSub();
    fxMix = oscControl->controlVal[1] * 2;
    ofSetColor(255, fxMix);
    drawFbo->draw();
    
    // Alpha Mask
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    alphaMask->draw();
    
    ofDisableAlphaBlending();
}
示例#18
0
//--------------------------------------------------------------
void meshTest::setup(){
    ofSetFrameRate(60);
    ofBackground(ofColor::black);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    
    myCam.setDistance(100);
    
    for (int i = 0; i < WIDTH; i++) {
        for (int j = 0; j < HEIGHT; j++) {
            myVerts[j * WIDTH + i].set(i - WIDTH / 2, j - HEIGHT / 2, 0);
            myColor[j * WIDTH + i].set(0.5, 0.8, 1.0, 1.0);
        }
    }
    
    myVbo.setVertexData(myVerts, NUM_PARTICLES, GL_DYNAMIC_DRAW);
    myVbo.setColorData(myColor, NUM_PARTICLES, GL_DYNAMIC_DRAW);
}
示例#19
0
void ofxGuiInputField<Type>::drawMesh(){
	ofBlendMode blendMode = ofGetStyle().blendingMode;
	if(blendMode!=OF_BLENDMODE_ALPHA){
		ofEnableAlphaBlending();
	}
	ofSetColor(textColor);

	bindFontTexture();
	textMesh.draw();
	unbindFontTexture();

	ofColor c = ofGetStyle().color;
	ofSetColor(c);
	if(blendMode!=OF_BLENDMODE_ALPHA){
		ofEnableBlendMode(blendMode);
	}
}
示例#20
0
void StFftBox::draw() {
    ofxUISlider *gboxsize = (ofxUISlider *)gui->getWidget("BOX SIZE"); float boxsize = gboxsize->getValue();
    ofxUIIntSlider *gskip = (ofxUIIntSlider *)gui->getWidget("SKIP"); int skip = gskip->getValue();
    ofxUISlider *gstiffness = (ofxUISlider *)gui->getWidget("STIFFNESS"); float stiffness = gstiffness->getValue();
    ofxUIIntSlider *gsaturation = (ofxUIIntSlider *)gui->getWidget("SATURATION"); int saturation = gsaturation->getValue();
    ofxUIIntSlider *gbrightness = (ofxUIIntSlider *)gui->getWidget("BRIGHTNESS"); int brightness = gbrightness->getValue();
    
    app->drawFbo->fbo.begin();
    app->drawFbo->blendMode = 1;
    ofDisableAlphaBlending();
    ofClear(0,0,0);
    post.begin(cam);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    ofEnableDepthTest();
    for (int i = 0; i < app->fft->drawBins.size(); i += skip){
        ofPushMatrix();
        float springForce = stiffness * -size[i];
        float addForce = app->fft->drawBins[i] * boxsize;
        force[i] = (springForce + addForce) * 0.2;
        size[i] += force[i];

        int controlHue = ofMap(app->oscControl->controlVal[3], 0, 127, 0, 160);
        int hueLow = controlHue;
        int hueHigh = (controlHue + 255 - 63);
        
        float hue = ofMap(i, 0, app->fft->drawBins.size(), hueLow, hueHigh);
        if (hueHigh > 255) {
            hueHigh = 255;
        }
        ofColor col;
        col.setHsb(hue, saturation, brightness);
        ofSetColor(col);
        ofRotateX(size[i] * rotSize[i].x);
        ofRotateY(size[i] * rotSize[i].y);
        ofRotateZ(size[i] * rotSize[i].z);
        ofBoxPrimitive box;
        box.set(size[i]);
        box.setResolution(2);
        box.draw();
        ofPopMatrix();
    }
    ofDisableDepthTest();
    ofDisableAlphaBlending();
    post.end();
    app->drawFbo->fbo.end();
}
示例#21
0
void StFftSphereStripe::draw(){
    ofxUISlider *gtopshift = (ofxUISlider *)gui->getWidget("TOP SHIFT"); float topshift = gtopshift->getValue();
    ofxUISlider *gshiftspeed = (ofxUISlider *)gui->getWidget("SHIFT SPEED"); float shiftspeed = gshiftspeed->getValue();
    ofxUISlider *gzoom = (ofxUISlider *)gui->getWidget("ZOOM"); float zoom = gzoom->getValue();
    ofxUISlider *ghue = (ofxUISlider *)gui->getWidget("HUE"); float hue = ghue->getValue();
    ofxUISlider *gsat = (ofxUISlider *)gui->getWidget("SAT"); float sat = gsat->getValue();
    ofxUISlider *gbr = (ofxUISlider *)gui->getWidget("BR"); float br = gbr->getValue();
    
    
    app->drawFbo->fbo.begin();
    app->drawFbo->blendMode = 0;
    post.begin(cam);
    ofScale(zoom, zoom);
    /*
    ofRotateX(ofGetElapsedTimef() * shiftspeed);
    ofRotateY(ofGetElapsedTimef() * shiftspeed * 1.1);
    ofRotateZ(ofGetElapsedTimef() * shiftspeed * 1.2);
     */
    
    ofRotateX(rotation.x * ofGetElapsedTimef());
    ofRotateY(rotation.y * ofGetElapsedTimef());
    ofRotateZ(rotation.z * ofGetElapsedTimef());
    //ofDisableAlphaBlending();
    ofClear(0,0,0,0);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    float controlHue;
    controlHue = ofMap(app->oscControl->controlVal[5], 0, 127, 0, 1);
    ofColor col; col.setHsb(controlHue * 255, sat * 255, br * 255);
    ofSetColor(col);
    glDisable(GL_CULL_FACE);
    tex.bind();
    mesh.draw();
    
    ofRotateX(10);
    ofRotateY(12);
    ofRotateZ(14);
    
    col.setHsb(int(controlHue * 255 + 127) % 255, sat * 255, br * 255);
    ofSetColor(col);
    mesh.draw();
    tex.unbind();
    
    post.end();
    app->drawFbo->fbo.end();
    ofDisableAlphaBlending();
}
示例#22
0
void StFftCubeDistort::draw(){
    ofxUISlider *gtopshift = (ofxUISlider *)gui->getWidget("TOP SHIFT"); float topshift = gtopshift->getValue();
    ofxUISlider *gshiftspeed = (ofxUISlider *)gui->getWidget("SHIFT SPEED"); float shiftspeed = gshiftspeed->getValue();
    ofxUISlider *gzoom = (ofxUISlider *)gui->getWidget("ZOOM"); float zoom = gzoom->getValue();
    //ofxUISlider *ghue = (ofxUISlider *)gui->getWidget("HUE"); float hue = ghue->getValue();
    ofxUISlider *gsat = (ofxUISlider *)gui->getWidget("SAT"); float sat = gsat->getValue();
    ofxUISlider *gbr = (ofxUISlider *)gui->getWidget("BR"); float br = gbr->getValue();
    
    
    app->drawFbo->fbo.begin();
    app->drawFbo->blendMode = 0;
    post->begin(cam);
    
    ofScale(zoom, zoom);

    ofDisableAlphaBlending();
    ofClear(0,0,0);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    float controlHue;
    controlHue = ofMap(app->oscControl->controlVal[5], 0, 127, 0, 0.65);
    ofColor col; col.setHsb(controlHue * 255, sat * 255, br * 255);
    ofSetColor(col);
    ofEnableDepthTest();
    //glEnable(GL_CULL_FACE);
    app->blackmagic->colorTexture.bind();
    
    ofPushMatrix();
    ofTranslate(-ofGetWidth()/3.5, 0);
    ofRotateX(rotationL.x * ofGetElapsedTimef());
    ofRotateY(rotationL.y * ofGetElapsedTimef());
    ofRotateZ(rotationL.z * ofGetElapsedTimef());
    mesh.draw();
    ofPopMatrix();
    ofPushMatrix();
    ofTranslate(ofGetWidth()/3.5, 0);
    ofRotateX(rotationR.x * ofGetElapsedTimef());
    ofRotateY(rotationR.y * ofGetElapsedTimef());
    ofRotateZ(rotationR.z * ofGetElapsedTimef());
    mesh.draw();
    ofPopMatrix();
    
    app->blackmagic->colorTexture.unbind();
    post->end();
    app->drawFbo->fbo.end();
    //ofDisableAlphaBlending();
}
示例#23
0
void StFftBox::draw() {
    ofxUISlider *gboxsize = (ofxUISlider *)gui->getWidget("BOX SIZE"); float boxsize = gboxsize->getValue();
    ofxUIIntSlider *gskip = (ofxUIIntSlider *)gui->getWidget("SKIP"); int skip = gskip->getValue();
    ofxUISlider *gstiffness = (ofxUISlider *)gui->getWidget("STIFFNESS"); float stiffness = gstiffness->getValue();
    ofxUIRangeSlider *ghue = (ofxUIRangeSlider *)gui->getWidget("HUE"); float hueLow = ghue->getValueLow(); float hueHigh = ghue->getValueHigh();
    ofxUIIntSlider *gsaturation = (ofxUIIntSlider *)gui->getWidget("SATURATION"); int saturation = gsaturation->getValue();
    ofxUIIntSlider *gbrightness = (ofxUIIntSlider *)gui->getWidget("BRIGHTNESS"); int brightness = gbrightness->getValue();
    
    app->drawFbo->fbo.begin();
    ofDisableAlphaBlending();
    ofClear(0,0,0);
    cam.begin();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    //ofTranslate(app->drawFbo->width / 2.0, app->drawFbo->height / 2.0);
    ofEnableDepthTest();
    //glCullFace(true);
    for (int i = 0; i < app->fft->drawBins.size(); i += skip){
        ofPushMatrix();
        float springForce = stiffness * -size[i];
        float addForce = app->fft->drawBins[i] * boxsize;
        force[i] = (springForce + addForce) * 0.2;
        size[i] += force[i];

        float hue = ofMap(i, 0, app->fft->drawBins.size(), hueLow, hueHigh);
        if (hue > 255) {
            hue = 255;
        }
        ofColor col;
        col.setHsb(hue, saturation, brightness);
        ofSetColor(col);
        ofRotateX(size[i] * rotSize[i].x);
        ofRotateY(size[i] * rotSize[i].y);
        ofRotateZ(size[i] * rotSize[i].z);
        ofBoxPrimitive box;
        box.set(size[i]);
        box.setResolution(2);
        box.draw();
        ofPopMatrix();
    }
    //glCullFace(false);
    ofDisableDepthTest();
    ofDisableAlphaBlending();
    cam.end();
    app->drawFbo->fbo.end();
}
//------------------------------------------------------------------
void grotesParticle::draw(){
//    ofDisableAlphaBlending();
    if (bHaradaFire) {
        ofEnableAlphaBlending();
        ofEnableBlendMode(OF_BLENDMODE_ADD);
        ofFill();
        if (bHaradaFireFadeOut) {
            fadeOut();
            ofSetColor (color);
        } else {
            ofSetColor (color);
        }
        ofCircle(pos.x, pos.y, scale * 0.6);
    } else {
        ofSetColor(0, 0, 0);
        ofCircle(pos.x, pos.y, scale);
    }
}
示例#25
0
//--------------------------------------------------------------
void testApp::draw()
{
    ofDisableAlphaBlending();
    ofSetColor(100,0,255);
    colorImg.draw(0,0);
    //colorImg.draw(20,20);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
    if(marking != NULL)
    {
        marking->draw();
    }
    
    for(int i = 0; i < markings.size(); i++)
    {
        markings[i]->draw();
    }
}
示例#26
0
//--------------------------------------------------------------
void testApp::setup(){
    
    // Syphon init
    ofSetWindowTitle("Generic IO");
    mainOutput.setName("GenericIO_Output");
    
    //render reset
    ofBackground(0);
    ofSetVerticalSync( TRUE );
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    ofSetBackgroundAuto(TRUE);
    ofSetFrameRate(60);

    //debug and beta
    counter = 0;
	ofSetCircleResolution(50);
}
示例#27
0
void XBScene1::drawDirector()
{
    XBScene1GUI *myGUI = (XBScene1GUI *) gui;

    // draw directors waves
    ofPushStyle();
    ofSetColor(myGUI->rgbColorDirectorR, myGUI->rgbColorDirectorG, myGUI->rgbColorDirectorB, myGUI->colorDirectorA);
    ofSetLineWidth(myGUI->lineWidth);
    for (Wave w:waves)
        w.display();
    ofPopStyle();

    // apply director mask
    ofPushStyle();
    ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
    wavesMask.draw(0, 0, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT);
    ofPopStyle();
}
示例#28
0
void ofxInkSim::stroke(BrashIF* brush, int x, int y, ofColor brushCol, float brushSize)
{
    brush->dragged(x, y);
    
    ofEnableBlendMode(OF_BLENDMODE_SCREEN);
    
    depositionBuffer.begin();
    ofClear(0, 0);
    ofPushStyle();
    ofSetColor(brushCol);
    brush->draw(brushSize);
    ofPopStyle();
    depositionBuffer.end();
    
    ofDisableBlendMode();
    
    depositeOnPaperSurface();
}
void testApp::draw(){
	
	// VBOの頂点を描画
	ofPushMatrix();
	ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
	cam.begin();
	glPointSize(2);
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	myVbo.draw(GL_POINTS, 0, NUM_PARTICLES);
	cam.end();
	ofPopMatrix();
	
	// ログの表示
	string info;
	info = "Vertex num = " + ofToString(NUM_PARTICLES, 0) + "\n";
	info += "FPS = " + ofToString(ofGetFrameRate(), 2);
	ofDrawBitmapString(info, 30, 30);
}
示例#30
0
void CloudsIntroSequence::selfDraw(){
  
	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
	glEnable(GL_LINE_SMOOTH);
	glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);	// allows per-point size
	glEnable(GL_POINT_SMOOTH);
	glDisable(GL_DEPTH_TEST);
	
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	
	drawCloudsType();
#ifdef OCULUS_RIFT
	drawIntroNodes();
#endif
	drawTunnel();
	drawPortals();
	drawHelperType();
}