• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ofFbo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ofFbo的典型用法代码示例。如果您正苦于以下问题:C++ ofFbo类的具体用法?C++ ofFbo怎么用?C++ ofFbo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ofFbo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: maskBlur

void testApp::maskBlur(ofBaseHasTexture& tex, ofFbo& result) {
	int k = ofMap(mouseX, 0, ofGetWidth(), 1, 128, true);
	
	halfMaskBlur.begin();
	ofClear(0, 0);
	maskBlurShader.begin();
	maskBlurShader.setUniformTexture("tex", tex, 1);
	maskBlurShader.setUniformTexture("mask", faceMask, 2);
	maskBlurShader.setUniform2f("direction", 1, 0);
	maskBlurShader.setUniform1i("k", k);
	tex.getTextureReference().draw(0, 0);
	maskBlurShader.end();
	halfMaskBlur.end();
	
	result.begin();
	ofClear(0, 0);
	maskBlurShader.begin();
	maskBlurShader.setUniformTexture("tex", halfMaskBlur, 1);
	maskBlurShader.setUniformTexture("mask", faceMask, 2);
	maskBlurShader.setUniform2f("direction", 0, 1);
	maskBlurShader.setUniform1i("k", k);
	halfMaskBlur.draw(0, 0);
	maskBlurShader.end();
	result.end();
}
开发者ID:Mat-Loz,项目名称:FaceSubstitution,代码行数:25,代码来源:testApp.cpp


示例2: doRender

void GaussianBlurFxModule::doRender(ofFbo& input) {
    if (m_param_enabled) {
        
        // first pass of shader: horizontal blur
        m_ping_pong_fbo.getPing().begin();
        ofClear(0.f);
        m_shader.begin();
        m_shader.setUniform1i("uVertical", false); // HORIZONTAL
        m_shader.setUniform1i("uStrength", m_param_strength);
        input.draw(0, 0);
        m_shader.end();
        m_ping_pong_fbo.getPing().end();
        
        // second pass of shader: vertical blur
        m_ping_pong_fbo.getPong().begin();
        ofClear(0.f);
        m_shader.begin();
        m_shader.setUniform1i("uVertical", true); // VERTICAL
        m_shader.setUniform1i("uStrength", m_param_strength);
        m_ping_pong_fbo.getPing().draw(0, 0);
        m_shader.end();
        m_ping_pong_fbo.getPong().end();
        
        // swap buffers: pong -> ping
        m_ping_pong_fbo.swap();
        
        // draw result of shader back to input fbo
        input.begin();
        ofClear(0.f);
        m_ping_pong_fbo.getPing().draw(0, 0);
        input.end();
    }
}
开发者ID:davidbeermann,项目名称:timely-matter,代码行数:33,代码来源:GaussianBlurFxModule.cpp


示例3: draw

void mdQuad::draw(ofFbo	fbo,ofShader shader){

	fbo.getTexture(0).bind();

    glBegin(GL_QUADS);
		
	glTexCoord2f(0.0,0.0);

	glVertex3f(x1, y1,  0.0);	// Bottom Left Of The Texture and Quad
  	glTexCoord2f(320,0);
	glVertex3f(x2, y2,  0.0);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(320,240);  
	glVertex3f( x3,  y3,  0.0);	// Top Right Of The Texture and Quad
	glTexCoord2f(0,240);  
	glVertex3f(x4, y4,  0.0);	// Top Left Of The Texture and Quad
	glEnd();
	
    //glActiveTexture(GL_TEXTURE0);
  fbo.getTexture().unbind();

	
	if(videoOn){
		videoTexture.setPoints(x1,y1,x2,y2,x3,y3,x4,y4);
		//videoTexture.loadData(vPlayer->getPixels(), vPlayer->getWidth(), vPlayer->getHeight(), GL_RGB);
		///videoTexture.loadData(fbo.getPixels(),fbo.getWidth(), fbo.getHeight(), GL_RGB);
		
		videoTexture.draw();
	}
}
开发者ID:tarrabass,项目名称:ARM,代码行数:29,代码来源:mdQuad.cpp


示例4: moveAndDraw

void Brush::moveAndDraw(float x, float y, ofFbo& fbo){
    ofPushStyle();
    pos.set(x, y);
    if (pos == lastPos || !isWorking) return;
    ofVec2f direc = pos - lastPos;
    ofVec2f perp = direc.perpendicular().normalize();
    ofVec2f target, diff, sum(0,0);
    lastPos.set(pos);
    
    fbo.begin();
    for (int i = 0; i < brushTips.size(); i ++) {
        target.set(perp.x * brushTipDevs[i] + x, perp.y * brushTipDevs[i] + y);
        brushTips[i] += (target - brushTips[i]) * 0.1;
        diff.set((target - brushTips[i]).normalize());
        ofSetColor(128 + diff.x * 128, 128 + diff.y * 128, 0, brushTipAlphas[i]);
        ofLine(brushTips[i], brushTipLogs[i]);
        brushTipLogs[i].set(brushTips[i]);
        sum += brushTips[i];
    }
    fbo.end();
    ofPopStyle();
    
    sum /= brushTips.size();
    lastPos.set(sum);
    
}
开发者ID:Silvercast,项目名称:apps_of0080_osx,代码行数:26,代码来源:brush.cpp


示例5: drawNormalized

void testApp::drawNormalized(ofxFaceTracker& tracker, ofBaseHasTexture& tex, ofFbo& result) {
	result.begin();
	tex.getTextureReference().bind();
	drawNormalized(tracker);
	tex.getTextureReference().unbind();
	result.end();
}
开发者ID:Mat-Loz,项目名称:FaceSubstitution,代码行数:7,代码来源:testApp.cpp


示例6: setup

        void setup(){
            ofSetVerticalSync(false);

            w=ofGetScreenWidth();
            h=ofGetScreenHeight();

            ofDisableArbTex();
            img.load("1.jpg");
            player.load("1.mp4");
            player.play();
            player.setLoopState(OF_LOOP_NORMAL);
            gray = img;
            gray.setImageType(OF_IMAGE_GRAYSCALE);
            wc.load("wcolor.vert","wcolor.frag");

            ofFbo::Settings s;
            s.depthStencilAsTexture=true;
            s.useDepth=true;
            s.width=w;
            s.height=h;
            fboDepth.allocate(s);
            fbo.allocate(w,h);
            fbo.begin();
            ofClear(0,0,100,255);
            fbo.end();

            gui.setup();
            gui.add(stepGradient.set("step gradient",    .0015, -1., 1.));
            gui.add(advectStep.set("step advect",        .0015, -.1, .1));
            gui.add(flipHeightMap.set("flip height map",  0.7,   0.,  2.));
            gui.add(time.set("time",  0.,   0.,  1.));
            gui.add(advectMatrix.set("advect matrix",  ofVec4f(0.1),   ofVec4f(-1.),  ofVec4f(1.)));
            gui.add(switchVideo.set("switch video", false));
        }
开发者ID:ReallyRad,项目名称:WaterColor,代码行数:34,代码来源:main.cpp


示例7: roi

		// draw texture in fbo using a normalized Region Of Interest
	void ftUtil::roi(ofFbo& _dst, ofTexture& _tex, ofRectangle _roi) {
		
		ofMesh quad;
		quad.setMode(OF_PRIMITIVE_TRIANGLE_FAN);
		
		quad.addVertex(glm::vec3(0,0,0));
		quad.addVertex(glm::vec3(_dst.getWidth(),0,0));
		quad.addVertex(glm::vec3(_dst.getWidth(),_dst.getHeight(),0));
		quad.addVertex(glm::vec3(0,_dst.getHeight(),0));
		
		float t0x = _roi.x * _tex.getWidth();
		float t0y = _roi.y * _tex.getHeight();
		float t1x = (_roi.x + _roi.width) * _tex.getWidth();
		float t1y = (_roi.y + _roi.height) * _tex.getHeight();
		
		quad.addTexCoord(glm::vec2(t0x, t0y));
		quad.addTexCoord(glm::vec2(t1x, t0y));
		quad.addTexCoord(glm::vec2(t1x, t1y));
		quad.addTexCoord(glm::vec2(t0x, t1y));
		
		_dst.begin();
		ofClear(0,0);
		_tex.bind();
		quad.draw();
		_tex.unbind();
		_dst.end();
	}
开发者ID:bossacorp,项目名称:ofxFlowTools,代码行数:28,代码来源:ftUtil.cpp


示例8: Obj

	Obj(ofFbo & videoFrame)
	:pixelsChanged(false)
	,createdTexPixels(false)
	{
		pixels.allocate(videoFrame.getWidth(),videoFrame.getHeight(),ofGetImageTypeFromGLType(videoFrame.getTextureReference().texData.glInternalFormat));
		updateTexture(videoFrame);
		total_num_frames++;
	}
开发者ID:jurcello,项目名称:ofxPlaymodes,代码行数:8,代码来源:VideoFrame.cpp


示例9: init

void Buffer::init(ofFbo &b, const ofColor &bg) {
    b.allocate();
    b.begin();
    ofFill();
    ofSetColor(bg);
    ofRect(0, 0, b.getWidth(), b.getHeight());
    b.end();
}
开发者ID:labe-me,项目名称:MindPaint,代码行数:8,代码来源:Utils.cpp


示例10: fill

void ofApp::fill(ofFbo &dest, ofFloatColor c, ofBlendMode mode){
    ofPushStyle();
    ofFill();
    ofEnableBlendMode(mode);
    ofSetColor(c);
    dest.begin();
    ofDrawRectangle(0, 0, dest.getWidth(), dest.getHeight());
    dest.end();
    ofPopStyle();
}
开发者ID:victor-shepardson,项目名称:audiovisual-feedback,代码行数:10,代码来源:ofApp.cpp


示例11: center

//--------------------------------------------------------------
void center(const ofTexture& texture, ofFbo& container,  int angle) {
  if (angle % 2 == 0) {
    ofTranslate(container.getWidth() * 0.5f - texture.getWidth()  * 0.5f,
                container.getHeight() * 0.5f - texture.getHeight() * 0.5f);
  }
  else {
    ofTranslate(container.getWidth() * 0.5f - texture.getHeight() * 0.5f,
                container.getHeight() * 0.5f - texture.getWidth()  * 0.5f);
  }
}
开发者ID:ragnaringi,项目名称:Periscope,代码行数:11,代码来源:Input.cpp


示例12: updateTexture

	void updateTexture(ofFbo & videoFrame){
		if(!fbo.isAllocated()){
			fbo.allocate(videoFrame.getWidth(),videoFrame.getHeight(),videoFrame.getTextureReference().texData.glInternalFormat);
		}
		videoFrame.bind();
		glReadBuffer(GL_COLOR_ATTACHMENT0);
		glBindTexture(fbo.getTextureReference().texData.textureTarget, (GLuint)fbo.getTextureReference().texData.textureID);
		glCopyTexImage2D(fbo.getTextureReference().texData.textureTarget,0,fbo.getTextureReference().texData.glInternalFormat,0,0,fbo.getWidth(),fbo.getHeight(),0);
		videoFrame.unbind();
		glReadBuffer(GL_BACK);
	}
开发者ID:jurcello,项目名称:ofxPlaymodes,代码行数:11,代码来源:VideoFrame.cpp


示例13: draw

	//----------
	void Scene::draw(ofFbo & fbo) {
		fbo.bind();
		
		ofPushMatrix();
		//ofScale(1.0f, -1.0f);
		//ofTranslate(0.0f, -ofGetHeight());
		
		this->draw();
		ofPopMatrix();
		
		fbo.unbind();
	}
开发者ID:elliotwoods,项目名称:ofxGrabScene,代码行数:13,代码来源:Scene.cpp


示例14: draw

//--------------------------------------------------------------
void ofxEasyFboGlitch::draw(ofFbo _fbo,float _drawX,float _drawY,float _drawW,float _drawH){
    fbo.begin();
    ofSetColor(255);
    ofBackground(0);
    _fbo.draw(0,0,fboW,fboH);
    fbo.end();
        if(glitchReset){
            reader.readToPixels(fbo, pix);
            glitchImg.setFromPixels(pix);
            glitchReset=false;
        }
        string breakImgName="glitch.jpg";
        glitchImg.saveImage(breakImgName,imgQuality);
        ofBuffer file= ofBufferFromFile(breakImgName);
        int fileSize=file.size();
        char *buffer = file.getBinaryBuffer();
        int whichByte=(int)ofRandom(fileSize);
        int whichBit =ofRandom(8);
        char bitMask = 1<< whichBit;
        buffer[whichByte] |= bitMask;
        ofBufferToFile(breakImgName,file);
        glitchImg.loadImage(breakImgName);
        if (ofRandom(1)<glitchResetProbability) {
            glitchReset=true;
        }
    glitchImg.draw(_drawX, _drawY, _drawW,_drawH);
}
开发者ID:bestpaul1985,项目名称:ofxEasyFboGlitch,代码行数:28,代码来源:ofxEasyFboGlitch.cpp


示例15: update

    void update()
	{
		fbo.begin();
			ofClear(0, 0, 0, 0);
			testImage.draw(0, 0);
        fbo.end();
    }
开发者ID:arturoc,项目名称:rendererTestApps,代码行数:7,代码来源:main.cpp


示例16: draw

//--------------------------------------------------------------
void testApp::draw(){
    ofSetHexColor(0xFFFFFF);
    ofBackground(0);

    if(bShowInput) grayImage.drawROI(roi.x, roi.y);
    if(bShowOutput) fbo.draw(0, 0);
    
    L.draw(pix);
    
    if(bInfo){
        ofSetHexColor(0xFF0000);
        char reportStr[1024];
    
        sprintf(reportStr, "[P] process on/off [F] snapshot [7 8 9 0] roi mask");
        ofDrawBitmapString(reportStr, 20, 10);
        sprintf(reportStr, "fps:%3.0f opencv:%3.2f madMapper:%3.2f", ofGetFrameRate(), t1, t2);
        ofDrawBitmapString(reportStr, 20, 25);
        sprintf(reportStr, "[1] show input [2] show output [i] info ");
        ofDrawBitmapString(reportStr, 20, 40);
        sprintf(reportStr, "[c] Contrast %.2f [b] Brightness %.2f ", contrast, brightness);
        ofDrawBitmapString(reportStr, 20, 55);
        sprintf(reportStr, "gray image [%4d, %4d] fbo [%4.f, %4.f] ",
                roiW, roiH, fbo.getWidth(), fbo.getHeight());
        
        int idx = (mouseY * pix.getWidth()+ mouseX) * pix.getBytesPerPixel();
        
        sprintf(reportStr, "pixels %d", pix.getPixels()[idx]);
        ofDrawBitmapString(reportStr, 20, 85);
    } 
}
开发者ID:miguelespada,项目名称:madMapperCV,代码行数:31,代码来源:testApp.cpp


示例17: update

	void update() {
		for(int i = 0; i < pulses.size(); i++) {
			pulses[i].update(people);
		}
		fbo.begin();
		ofPushStyle();
		ofSetLineWidth(30);
		ofSetColor(0, 10);
		ofFill();
		ofRect(0, 0, fbo.getWidth(), fbo.getHeight());
		ofSetColor(255);
		ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2);
		float saturation = ofMap(pulses.size(), 1, 10, 0, 255, true);
		for(int i = 0; i < pulses.size(); i++) {
			ofPushMatrix();
			ofRotate(pulses[i].getAngle());
			ofSetColor(ofColor::fromHsb(pulses[i].getHue(), saturation, 255));
			ofLine(0, 0, ofGetWidth() / 2, 0);
			ofPopMatrix();
		}
		ofPopStyle();
		fbo.end();
		fbo.readToPixels(fboPixels);
		ledRing.update(fboPixels);
		float presence = 0;
		for(int i = 0; i < people.size(); i++) {
			presence += people[i].getPresence();
		}
		presence /= people.size();
		midi.sendControlChange(2, 1, presence);
	}
开发者ID:HellicarAndLewis,项目名称:ProjectRadarSequencer,代码行数:31,代码来源:main.cpp


示例18: draw

//--------------------------------------------------------------
void ofApp::draw(){

	ofBackground(255,255,255); //Устанавливаем белый фон

	//1. Рисуем в буфер
	fbo.begin();

	//Рисуем полупрозрачный белый прямоугольник, который будет создавать эффект исчезновения
	ofEnableAlphaBlending(); 

	float alpha = (1-history) * 255;
	ofSetColor(255,255,255,alpha);
	ofFill();
	ofRect(0,0,ofGetWidth(),ofGetHeight());

	ofDisableAlphaBlending();

	//Рисуем частицу
	ofFill();
	for (int i=0; i<p.size(); ++i)
	{
		p[i].draw();
	}
	fbo.end();

	//2. Рисуем содержимое буфера на экране
	ofSetColor(255,255,255);
	fbo.draw(0,0);
}
开发者ID:IlyaMelnix,项目名称:Particles,代码行数:30,代码来源:ofApp.cpp


示例19: draw

        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();
        }
开发者ID:ReallyRad,项目名称:WaterColor,代码行数:26,代码来源:main.cpp


示例20: setupedFbo

 void setupedFbo()
 {
     if (!mFbo.isAllocated()) {
         mFbo.allocate(getWidth(), getHeight(), GL_RGBA);
         mGlitch.setup(&mFbo);
         mGlitch.setFx(OFXPOSTGLITCH_TWIST, true);
     }
 }
开发者ID:TatsuyaOGth,项目名称:biopulse,代码行数:8,代码来源:TwiceObject.hpp



注:本文中的ofFbo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ofFile类代码示例发布时间:2022-05-31
下一篇:
C++ ofEasyCam类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap