示例#1
0
void testApp::drawBlurred(){

	blurBG.begin(1,2);
	ofClear(0, 0, 0, 255); //black bg
	glPushMatrix();
	glTranslatef(screenWidth/2, screenHeight/2, 0);
	for(int i = 0; i < stars2d.size(); i ++){ 
		for(int j = 0; j < stars2d[i].size(); j ++){ 
			stars2d[i][j]->drawBG(false);
		}
	}
	
	glPopMatrix();
	blurBG.end();
	
	ofSetColor(255);
	blurBG.draw(); 
	
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	ofSetColor(230,255,230, bg_alpha);
	bg.draw(0,0,screenWidth,screenHeight);
	ofDisableBlendMode();
	
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	glPushMatrix();
	glTranslatef(screenWidth/2, screenHeight/2, 0);
	
	for(int i = 0; i < stars2d.size(); i ++){ 
		for(int j = 0; j < stars2d[i].size(); j ++){ 
			stars2d[i][j]->drawBG(true);
		}
	}
	
	glPopMatrix();
	ofSetColor(255, 255, 255, 255);
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	ofDisableBlendMode();
	
	glPushMatrix();
	glTranslatef(screenWidth/2, screenHeight/2, 0);
	for(int i = 0; i < stars2d.size(); i ++){ 
		for(int j = 0; j < stars2d[i].size(); j ++){ 
			stars2d[i][j]->drawActiveAlgorithm(); 
		}
	}
	glPopMatrix();
	ofSetColor(255, 255, 255, 255);

}
//-------------------------------------------------------------- LOOP
void ofxComposer::update(){
    for(map<int,patch*>::iterator it = patches.begin(); it != patches.end(); it++ ){
        it->second->update();
    }
    
    if ( (bEditMode) && (selectedID >= 0)){
#ifdef USE_OFXGLEDITOR
        if (patches[selectedID]->getType() == "ofShader"){
            editorBgColor.lerp(ofColor(0,150), 0.01);
            editorFgColor.lerp(ofColor(255,255), 0.1);
        } else {
            editorBgColor.lerp(ofColor(0,0), 0.01);
            editorFgColor.lerp(ofColor(0,0), 0.05);
        }
        
        editorFbo.begin();
        //ofEnableAlphaBlending();
        ofClear(editorBgColor);
        ofDisableBlendMode();
        ofRotate(180, 0, 1, 0);
        ofSetColor(255,255);
        editor.draw();
        editorFbo.end();
#endif
    }
    
}
示例#3
0
void Water::draw() {
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    
    // 水面と水中の描写
    ofSetLineWidth(0);
    ofSetColor(0, 100, 155, 150);
    ofBeginShape();
    ofVertex(waterWidth, border+waterLevel);
    ofVertex(waterWidth, waterHeight+100);
    ofVertex(0, waterHeight+100);
    ofVertex(0, border+waterLevel);
    for (int i=0; i<borderCircles.size(); i++) {
        ofVec2f pos = borderCircles[i].get()->getPosition();
        ofCurveVertex(pos.x, pos.y);
    }
    ofEndShape();
    
    ofSetColor(255, 255);
    // 泡の描写
    for (int i=0; i<bubbles.size(); i++) {
        ofVec2f pos = bubbles[i].get()->getPosition();
        float size = bubbles[i].get()->getRadius();
        img.draw(pos, size*2, size*2);
    }
    
    ofSetColor(255, 150);
    //fbo.draw(0, border + waterLevel);
    
    ofDisableBlendMode();
}
示例#4
0
void Bacteria::draw(int x, int y){
    
    ofSetColor(255,255,255,200 * alpha);
   
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_SCREEN);
    
    for (int i = 0; i < bacteriaPos.size(); i++) {
        ofPoint pos;
        pos.set(bacteriaPos[i].x + x, bacteriaPos[i].y + y);
        
        //ofCircle(bacteriaPos[i].x + x, bacteriaPos[i].y + y, 2 * scale);
        
        float w = bacteria[bacteriaType[i]].width * scale / 30.f;
        float h = bacteria[bacteriaType[i]].height * scale / 30.f;
        
        ofPushMatrix();
        ofTranslate(pos.x, pos.y);
        ofRotate(bacteriaRotation[i]);
        
        //bacteria[bacteriaType[i]].draw(pos.x - w/2, pos.y -h/2, w, h);
        bacteria[bacteriaType[i]].draw( -w/2, -h/2, w, h);
        
        ofPopMatrix();
    }
    
    ofDisableBlendMode();
    ofDisableAlphaBlending();
}
示例#5
0
//--------------------------------------------------------------
//* Live Delayed Mirrored Shadow - Participants Shadow a second behind live action
//--------------------------------------------------------------
void ofApp::playSlowMirroredShadow()
{
    modeString = "Mirrored Shadow";

    ofSetColor(255);
    if (!videoImage.empty())
    {
        ofImage reverseImg;
        reverseImg.setFromPixels(openCV.getRecordPixels());
        reverseImg.mirror(false, true);
        reverseImg.draw(0,0, ofGetWidth(), ofGetHeight());
    }
    
    // Draw the first buffer in the Vector
    if (!buffers.empty())
    {
        if (backColor.getBrightness() >=125)
        {
            ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
        }
        else if (backColor.getBrightness() <= 124)
        {
            ofEnableBlendMode(OF_BLENDMODE_ADD);
        }
        else
        {
            
        }
        openCV.drawLiveShadow();
        ofDisableBlendMode();
    }
}
示例#6
0
//--------------------------------------------------------------
//* Live and kicking - If Someone walks through the Camera view, play the last persons buffer
//* and Simultaneously play the current shadow view.
//--------------------------------------------------------------
void ofApp::playLiveImageWithBufferTriggered()
{
    modeString = "Live Image and Buffer";
    if(openCV.isSomeoneThere())
    {
        if (!buffers.empty())
        {
            buffers[0].start();
        }
    }
   
    // Draw the first buffer in the Vector
    if (!buffers.empty())
    {
        
        openCV.drawLiveShadow();
        if (backColor.getBrightness() >=125)
        {
            ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
        }
        else if (backColor.getBrightness() <= 124)
        {
            ofEnableBlendMode(OF_BLENDMODE_ADD);
        }
        else
        {
            
        }
        buffers[0].draw();
        ofDisableBlendMode();
    }
}
示例#7
0
void ofxComposer::draw(){
    ofPushView();
    ofPushStyle();
    ofPushMatrix();
    
    ofEnableAlphaBlending();
    for(int i = 0; i < patches.size(); i++){
        patches[i]->draw();
    }
    
    if ( bGLEditor && (selected >= 0)){
        if (patches[selected]->getType() == "ofShader"){
            editorFbo.begin();
            ofClear(0, 150);
            ofRotate(180, 0, 1, 0);
            editor.draw();
            editorFbo.end();
        } else {
            editorFbo.begin();
            ofClear(0, 50);
            editorFbo.end();    
        }
    } 
    
    if (selectedDot >= 0){
        ofLine(patches[selectedDot]->getOutPutPosition(), ofPoint(ofGetMouseX(),ofGetMouseY()));
    }
    
    ofDisableBlendMode();
    ofEnableAlphaBlending();
    
    ofPopMatrix();
    ofPopStyle();
    ofPopView();
}
示例#8
0
//--------------------------------------------------------------
void ofApp::draw(){

	glDepthMask(GL_FALSE);
	
	ofColor c;
	c.setHsb(18,160,80);
	ofSetColor(c);
	
	// this makes everything look glowy :)
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	ofEnablePointSprites();
	
	// bind the shader and camera
	// everything inside this function
	// will be effected by the shader/camera
	shader.begin();
	camera.begin();

	// bind the texture so that when all the swarm.positions 
	// are drawn they are replace with our dot image
	texture.bind();
	vbo.draw(GL_POINTS, 0, (int)swarm.positions.size());
	texture.unbind();

	camera.end();
	shader.end();
	
	ofDisablePointSprites();
	ofDisableBlendMode();

	ofDrawBitmapString("framerate: " + ofToString(ofGetFrameRate()),ofGetWidth() - 160, 20);

}
示例#9
0
//--------------------------------------------------------------
void testApp::draw(){
	
    //按1-5切换不同混合模式
    sprintf(timeString, "Press 1 - 5 to switch blend modes");
	
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
	ofSetHexColor(0xffffff);
	vagRounded.drawString(eventString, 98,198);
	
	ofSetColor(255,122,220);
	vagRounded.drawString(eventString, 100,200);
	
	ofSetHexColor(0xffffff);
	vagRounded.drawString(timeString, 98,98);
	
	ofSetColor(255,122,220);
	vagRounded.drawString(timeString, 100,100);

    ofSetColor(255, 255, 255,255);
    
    
    ofEnableBlendMode(blendMode);
    
    rainbow.draw(mouseX, mouseY);
    
    ofDisableBlendMode();
}
示例#10
0
void StKaleidoscopeGJ::draw(){
    ofxUISlider *gsat = (ofxUISlider *)gui->getWidget("SAT"); float sat = gsat->getValue();
    ofxUISlider *gbr = (ofxUISlider *)gui->getWidget("BR"); float br = gbr->getValue();
    ofxUISlider *gzoom = (ofxUISlider *)gui->getWidget("ZOOM"); float zoom = gzoom->getValue();
    
    float hue =ofMap(app->oscControl->controlVal[5], 0, 127, 0.0, 1.0);
    app->drawFbo->fbo.begin();
    app->drawFbo->blendMode = 0;
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    ofSetColor(0, 0, 0, 20);
    ofRect(0, 0, ofGetWidth(), ofGetHeight());
    ofTranslate(0, -app->drawFbo->top);
    //ofEnableBlendMode(OF_BLENDMODE_ADD);
    ofTranslate(0, -app->drawFbo->top);

    ofScale(1.0 / fxRatio, 1.0 / fxRatio);
    post->begin(cam);
    ofPushMatrix();
    ofScale(zoom, zoom);
    ofColor col; col.setHsb(hue * 255, sat * 255, br * 255);
    ofSetColor(col);
    ofRotateZ(ofGetElapsedTimef() * 40.0);
    app->blackmagic->colorTexture.draw(-app->blackmagic->width/2, -app->blackmagic->height/2, app->blackmagic->width, app->blackmagic->height);
    ofPopMatrix();
    post->end();
    app->drawFbo->fbo.end();
    ofDisableBlendMode();
    
    gui->setVisible(getSharedData().guiVisible);
}
示例#11
0
void ofxInkSim::depositeOnPaperSurface()
{
    ofEnableBlendMode(OF_BLENDMODE_SCREEN);
    
    surfInk.getNewTex()->begin();
    ofClear(0, 0);
    addpigment.update(width, height,
                      pxSize,
                      uniforms->gamma,
                      uniforms->baseMask,
                      surfInk.getOldTex()->getTextureReference(),
                      depositionBuffer.getTextureReference(),
                      misc.getOldTex()->getTextureReference());
    surfInk.getNewTex()->end();
    surfInk.swap();
    
    misc.getNewTex()->begin();
    ofClear(0, 0);
    addwater.update(width, height,
                    pxSize,
                    uniforms->gamma,
                    uniforms->baseMask,
                    uniforms->waterAmount,
                    misc.getOldTex()->getTextureReference(),
                    depositionBuffer.getTextureReference());
    misc.getNewTex()->end();
    misc.swap();
    
    ofDisableBlendMode();
}
示例#12
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofBackground(0, 0, 0);
    //myImage2.draw(0, 0);
    ofEnableBlendMode ( OF_BLENDMODE_ADD ) ;
    if(useKinect){
        for(int i = 0; i<ps.size(); i++){
            int ind = indices[i];
            if (myImage2.getColor(int(ind%640), int(ind/480)) == ofColor(255, 255, 255)) {
                ps[i].setEmitter(int(ind%640), int(ind/480));
                ps[i].setColor(gColor);
                mesh.setColor(i, gColor);
            }
            else{
                ps[i].setEmitter(int(ind%640+ofRandom(-4, 4)), int(ind/480 + ofRandom(-4, 4)));
                ps[i].setColor(ofColor(0));
                mesh.setColor(i, ofColor(0));
            }
            ps[i].draw();
        }
    }
    else{
        for(int i = 0; i<ps.size(); i++){
            ps[i].setEmitter(ofRandom(ofGetWidth()), ofRandom(ofGetHeight()));
            ps[i].draw();
        }
    }
    //drawPointCloud();
    gui.draw();
    ofSetColor(255);
    ofDrawBitmapString("FPS: " + ofToString( ofGetFrameRate()), ofGetWidth()-100, 15);
    ofDrawBitmapString("Particulas: " + ofToString(ps.size()), ofGetWidth()-200, 30);
    ofDrawBitmapString("Num Pixels: " + ofToString(indices.size()), ofGetWidth()-200, 45);
    ofDisableBlendMode();
}
示例#13
0
void StFftDistortNotex::draw(){
    ofxUISlider *gtopshift = (ofxUISlider *)gui->getWidget("TOP SHIFT"); float topshift = gtopshift->getValue();
    ofxUISlider *glinewidth = (ofxUISlider *)gui->getWidget("LINE WIDTH"); float linewidth = glinewidth->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;
    ofDisableAlphaBlending();
    ofClear(0,0,0);
    ofVec2f scale = ofVec2f(ofGetWidth() / float(app->blackmagic->colorTexture.getWidth()),
                            ofGetHeight() / float(app->blackmagic->colorTexture.getHeight()));
    ofPushMatrix();
    //ofScale(scale.x, scale.y);
    ofSetColor(255);
    //ofTranslate(0, -app->drawFbo->top + topshift);
    ofDisableBlendMode();
    float hue =ofMap(app->oscControl->controlVal[5], 0, 127, 0.7, 1.0);
    ofColor col; col.setHsb(hue * 255, sat * 255, br * 255);
    ofSetColor(col);
    ofSetLineWidth(linewidth);
    if (linewidth > 0) {
        mesh.drawWireframe();
    }
    ofPopMatrix();
    app->drawFbo->fbo.end();
    ofDisableAlphaBlending();
}
示例#14
0
void StCvOpMesh::draw() {
    ofxUIIntSlider *gmax = (ofxUIIntSlider *)gui->getWidget("MAX");
    int max = gmax->getValue();
    ofxUISlider *gradius = (ofxUISlider *)gui->getWidget("RADIUS");
    float radius = gradius->getValue();
    ofxUIIntSlider *gfade = (ofxUIIntSlider *)gui->getWidget("FADE");
    int fade = gfade->getValue();
    ofxUIToggle *gclear = (ofxUIToggle *)gui->getWidget("CLEAR BACKGROUND");
    bool clear = gclear->getValue();
    ofPixelsRef pix = ((ofApp*)ofGetAppPtr())->blackmagic->colorPixels;

    app->drawFbo->fbo.begin();
    app->drawFbo->blendMode = 0;
    ofTranslate(0, -app->drawFbo->top);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    ofSetColor(0, 0, 0, fade);
    ofRect(0, 0, ofGetWidth(), ofGetHeight());

    mesh.clear();
    for (int i = 0; i < particles.size(); i++) {
        mesh.addVertex(ofVec3f(particles[i]->position.x,
                               particles[i]->position.y, 0));
        mesh.addColor(ofFloatColor(particles[i]->col.r/255.0, particles[i]->col.g/255.0, particles[i]->col.b/255.0));
    }

    ofEnableBlendMode(OF_BLENDMODE_ADD);
    ofSetColor(255);
    glPointSize(radius);
    mesh.draw();

    ofDisableBlendMode();
    app->drawFbo->fbo.end();

    gui->setVisible(getSharedData().guiVisible);
}
示例#15
0
void testApp::draw() {
	ofBackground(0);

	int n = fbos.size();
	
	ofPushMatrix();
	ofSetColor(255);
	for(int i = 0; i < n; i++) {
		fbos[i]->draw(0, 0);
		ofTranslate(0, fbos[i]->getHeight());
	}
	ofPopMatrix();
	
	ofTranslate(cam.getWidth(), 0);
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	for(int i = 0; i < n; i++) {
		#ifdef SOFTER
		float total = n * (n + 1) / 2;
		float weight = (i + 1) / total;
		ofSetColor(ofFloatColor(weight));
		#else
		ofSetColor(ofFloatColor(1. / n));
		#endif
		fbos[i]->draw(0, 0, cam.getWidth(), cam.getHeight());
	}
	ofDisableBlendMode();
}
示例#16
0
文件: hole.cpp 项目: jftesser/blobs
void hole::draw() {
   if (mFreed) {
            ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
            ofEnableSmoothing();
            ofSetLineWidth(1.25);
            
            ofNoFill();
            ofSetColor(255,0,128);
            ofBeginShape();
            for (auto v : mVerts){
                ofVertex(v->pos.x, v->pos.y);
            }
            ofEndShape();
            
            
            ofSetColor(255,0,128);
            for (auto v : mVerts){
                ofFill();
                if (v->bOver == true) {
                    ofCircle(v->pos.x, v->pos.y,12);
                } else {
                    ofCircle(v->pos.x, v->pos.y,8);
                }
            }
            
            ofDisableBlendMode();
        

  }
}
void yeseulCooperMessages::draw(){
    
    ofPushStyle();
    ofEnableBlendMode(OF_BLENDMODE_ADD);

    // uncomment the following line when the texture is disabled
    // ofBackground(56, 39, 36);
    
    // comment out the following two lines to disable texture on the background
    ofBackground(10, 0, 0);
    texture.draw(0.0, 0.0);
    
    ofRectangle rec1 = font.getStringBoundingBox(text1, 100, 100);
    ofRectangle rec2 = font.getStringBoundingBox(text2, 100, 100);
    
    ofPushMatrix();
    ofTranslate(dimensions.width/2, dimensions.height/2);
    
    tensionEffect(rec1, rec2);
    animateText(rec1, rec2);
    
    ofPopMatrix();
    
    ofDisableBlendMode();
    ofPopStyle();
    
}
示例#18
0
//--------------------------------------------------------------
void ofApp::updateGPUParticles(){
    // Rendering
    renderFBO.begin();
    ofClear(0,0,0,0);
    updateRender.begin();
    updateRender.setUniformTexture("posTex", posFBO.getTextureReference(), 0);
    updateRender.setUniformTexture("sparkTex", sparkImg.getTextureReference() , 1);
    updateRender.setUniform1i("resolution", (float)textureRes);
    updateRender.setUniform2f("screen", (float)width, (float)height);
    updateRender.setUniform1f("size", (float)particleSize);
    updateRender.setUniform1f("imgWidth", (float)sparkImg.getWidth());
    updateRender.setUniform1f("imgHeight", (float)sparkImg.getHeight());
    
    ofPushStyle();
    ofEnableBlendMode( OF_BLENDMODE_ADD );
    ofSetColor(255);
    
    mesh.draw();
    
    ofDisableBlendMode();
    glEnd();
    
    updateRender.end();
    renderFBO.end();
    ofPopStyle();
}
示例#19
0
文件: testApp.cpp 项目: Mana-Hanno/oF
//--------------------------------------------------------------
void ofApp::draw(){
	ofSetColor(255, 255, 255);
    
    ofPushMatrix();
    
    for (int deviceID = 0; deviceID < numDevices; deviceID++){
        ofTranslate(0, deviceID * 480);
        openNIDevices[deviceID].drawDebug(); // debug draw does the equicalent of the commented methods below
//        openNIDevices[deviceID].drawDepth(0, 0, 640, 480);
//        openNIDevices[deviceID].drawImage(640, 0, 640, 480);
//        openNIDevices[deviceID].drawSkeletons(640, 0, 640, 480);
        
    }

    // do some drawing of user clouds and masks
    ofPushMatrix();
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    int numUsers = openNIDevices[0].getNumTrackedUsers();
    for (int nID = 0; nID < numUsers; nID++){
        ofxOpenNIUser & user = openNIDevices[0].getTrackedUser(nID);
        user.drawMask();
        ofPushMatrix();
        ofTranslate(320, 240, -1000);
        user.drawPointCloud();
        ofPopMatrix();
    }
    ofDisableBlendMode();
    ofPopMatrix();
    
	ofSetColor(0, 255, 0);
	string msg = " MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + " FPS: " + ofToString(ofGetFrameRate());
	verdana.drawString(msg, 20, numDevices * 480 + 26);
}
示例#20
0
//--------------------------------------------------------------
void ofApp::draw(){
	ofSetColor(255);
    ofPushMatrix();
    kinect.drawDebug();
    ofPopMatrix();
    ofPushMatrix();
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    int numUsers = kinect.getNumTrackedUsers();
    for (int i = 0; i < numUsers; i++){
        ofxOpenNIUser & user = kinect.getTrackedUser(i);
        ofPushMatrix();
        user.drawMask();
        ofPopMatrix();
    }
    ofDisableBlendMode();
    ofPopMatrix();
    

    // PROJECTOR VIEW
    
    projector.begin();

    ofBackgroundGradient(ofColor::gray, ofColor::black, OF_GRADIENT_LINEAR);
    fluid.draw();
    
    projector.end();
    
}
示例#21
0
//--------------------------------------------------------------
void testApp::drawOscilloscopeLines()
{
	ofEnableBlendMode(OF_BLENDMODE_ADD);
	ofSetColor(60, 150, 80, 175);
	for(int i = 1; i < 7; i++)
	{
		ofSetLineWidth(i);
		ofPushMatrix();
		{
			ofTranslate(0, ofGetHeight()/8 - 5);
			oscLineLeft.draw();
			ofTranslate(0, ofGetHeight()/2);
			oscLineRight.draw();
		}
		ofPopMatrix();
	}
	ofDisableBlendMode();
	
	ofSetColor(255);
	ofSetLineWidth(2);
	ofPushMatrix();
	{
		ofTranslate(0, ofGetHeight()/8 - 5);
		oscLineLeft.draw();
		ofTranslate(0, ofGetHeight()/2);
		oscLineRight.draw();
	}
	ofPopMatrix();
}
示例#22
0
void edgeCurve::draw() {
    if (mIsSlave == false) {
        updatePath();
        mPath->draw();
    }
    
    if (mLocked == false) {
        ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
        ofEnableSmoothing();
        ofSetLineWidth(1.25);
        
        ofNoFill();
        ofSetColor(255,0,128);
        ofBeginShape();
        for (auto v : mVerts){
            ofVertex(v->pos.x, v->pos.y);
        }
        ofEndShape();
        
        
        ofSetColor(255,0,128);
        for (auto v : mVerts){
            ofFill();
            if (v->bOver == true) {
                ofCircle(v->pos.x, v->pos.y,12);
            } else {
                ofCircle(v->pos.x, v->pos.y,8);
            }
        }
        
        ofDisableBlendMode();
    }
    
    
    if (mHole) mHole->draw();
    if (mSlaveHole) mSlaveHole->draw();
    
    ofFill();
    ofSetColor(255);
    if (mDrawZipper) {
        ofEnableBlendMode(OF_BLENDMODE_SCREEN);
        mZipperPath->draw();
        ofDisableBlendMode();
    }
    
    
}
示例#23
0
void ofxInkSim::fillDisorderBuffer()
{
    ofEnableBlendMode(OF_BLENDMODE_SCREEN);
    disorder.begin();
    GAP.update(width, height, pxSize, grain, alum, pinning);
    disorder.end();
    ofDisableBlendMode();
}
示例#24
0
void PMRibbonPainter::draw()
{
    if (isNewPath) return;
    
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    path.draw();
    ofDisableBlendMode();
}
void Model::draw(ofMatrix4x4 camMvpMatrix)
{
    ofDisableBlendMode();
    glEnable(GL_CULL_FACE);
    glFrontFace(GL_CCW);
    
    diffuseTex.bind();
    shader.begin();
    ofPushStyle();
    
    shader.setUniformMatrix4f("camMvpMatrix", camMvpMatrix);
    shader.setUniformTexture("modelTransTexture", modelTransTexture, 1);
    
    for (auto p : pieces)
    {
        shader.setUniformTexture("animationTexture", p.instancedAnimTextre, 2);
        shader.setUniformTexture("diffuseTex", diffuseTex, 3);
        
        p.material.begin();
        
        ofPolyRenderMode drawMode = OF_MESH_FILL;
        int primCount = nInstance;
        GLuint mode = ofGetGLPrimitiveMode(OF_PRIMITIVE_TRIANGLES);
        glPolygonMode(GL_FRONT_AND_BACK, ofGetGLPolyMode(drawMode));
        
        if (p.vbo.getNumIndices() && drawMode != OF_MESH_POINTS)
        {
            if (primCount <= 1)
            {
                p.vbo.drawElements(mode, p.vbo.getNumIndices());
            }
            else
            {
                p.vbo.drawElementsInstanced(mode, p.vbo.getNumIndices(), primCount);
            }
        }
        else
        {
            if (primCount <= 1)
            {
                p.vbo.draw(mode, 0, p.vbo.getNumVertices());
            }
            else
            {
                p.vbo.drawInstanced(mode, 0, p.vbo.getNumVertices(), primCount);
            }
        }
        
        p.material.end();
    }
    
    ofPopStyle();
    shader.end();
    diffuseTex.unbind();
    
    glDisable(GL_CULL_FACE);
    ofEnableAlphaBlending();
}
示例#26
0
//--------------------------------------------------------------
void Surface::drawMask()
{
	if (m_isDrawMask && mp_mask)
	{
		ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
		mp_mask->draw(0,0,m_fbo.getWidth(),m_fbo.getHeight());
		ofDisableBlendMode();
	}
}
示例#27
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofSetColor(210);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    static GLfloat distance[] = { 0.0, 0.0, 1.0 };
    glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, distance);
    glPointSize(4000);
    mesh.draw();
    ofDisableBlendMode();
}
示例#28
0
void ofxWater::draw(int x, int y){
    renderFbo.draw(x,y);
    
    // Add more lighten effect
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    ofSetColor(100,255);
    updateFbo.draw(x,y);
    ofDisableBlendMode();
}
示例#29
0
void ofxInkSim::end()
{
    ofPopStyle();
    depositionBuffer.end();
    
    ofDisableBlendMode();
    
    depositeOnPaperSurface();
}
示例#30
0
void electromagnetica::draw(){
        //
    
    ofBackground(0);
    
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_SCREEN);
    ofPushMatrix(); //colocamos el canvas en su posicion centrada
    //post.begin();
        ofTranslate((ofGetWidth()-W_WIDTH)/2, 0);
       // drawNoise();
    
        ofNoFill();
        //ofEllipse(W_WIDTH/2, W_WIDTH/2, W_WIDTH, W_WIDTH);
       //
        ofPushMatrix();

            meshParticles.setMode(OF_PRIMITIVE_POINTS);
                meshAux.setMode(OF_PRIMITIVE_POINTS);
            glPointSize(2);
            glEnable(GL_POINT_SMOOTH);	// Para que sean puntos redondos
            ofEnableDepthTest();

            meshParticles.draw();
            meshAux.draw();

            ofDisableDepthTest();
            ofSetColor(255,0,0);
            ofFill();
        if(drawlines) wavesm.draw();

        ofPopMatrix();
        hands.draw();
    
        ofPushMatrix();
            //ofTranslate(200,200);
       // drawEM();
        ofPopMatrix();
    //post.end();
    ofPopMatrix();
  

    ofDisableBlendMode();
    ofDisableAlphaBlending();
    borde.draw();
    if(bdrawDebug)    showDebug();
    
  /*  //wavesm.debugInfo();
    ofPushStyle();
	ofSetColor(255,255,255);
	ofDrawBitmapString("fr: " + ofToString(ofGetFrameRate()), 50, ofGetHeight()-90);
	ofPopStyle();
   
   
*/
}