当前位置: 首页>>代码示例>>C++>>正文


C++ ofFbo::getTextureReference方法代码示例

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


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

示例1: draw

//--------------------------------------------------------------
void testApp::draw(){
	ofEnableLighting();
	light.enable();
	if(rotating) t++;
	fbo.begin();
	glColor4f(1, 1, 1, 1);
	ofClear(0, 0, 0, 0);
	
	glPushMatrix();
	glScalef(2, 2, 2);
	glTranslatef(ofGetWidth()/2, ofGetHeight()/2, 0);
	glRotatef(t, 0, 1, 1);
	/*glBegin(GL_QUADS);
	glVertex2f(-100, -100);
	glVertex2f(100, -100);
	glVertex2f(100, 100);
	glVertex2f(-100, 100);
	
	glEnd();*/
	ofBox(0, 0, 0, 100);
	glPopMatrix();
	fbo.end();
	
	ofDisableLighting();

	if(shading) {
		fxaa.begin();
		fxaa.setUniformTexture("bgl_RenderedTexture", fbo.getTextureReference(0), 0);
		fxaa.setUniform1f("bgl_RenderedTextureWidth", fbo.getWidth());
		fxaa.setUniform1f("bgl_RenderedTextureHeight", fbo.getHeight());
	} else {
		fbo.getTextureReference(0).bind();
	}
	glBegin(GL_QUADS);
	
	glTexCoord2f(0, 0);
	glVertex2f(0, 0);
	
	glTexCoord2f(fbo.getWidth(), 0);
	glVertex2f(ofGetWidth(), 0);
	
	glTexCoord2f(fbo.getWidth(), fbo.getHeight());
	glVertex2f(ofGetWidth(), ofGetHeight());
	
	glTexCoord2f(0, fbo.getHeight());
	glVertex2f(0, ofGetHeight());
	
	glEnd();

	if(shading) {
		fxaa.end();
	} else {
		fbo.getTextureReference(0).unbind();
	}

}
开发者ID:mazbox,项目名称:ElectricityComesFromOtherPlanets,代码行数:57,代码来源:testApp.cpp

示例2: 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

示例3: render

 void FakeSSSPass::render(ofFbo& readFbo, ofFbo& writeFbo, ofTexture& depthTex)
 {
     writeFbo.begin();
     
     shader.begin();
     
     shader.setUniformTexture("Texture", readFbo.getTextureReference(), 0);
     shader.setUniform3f("LightPosition", lightPosition.x, lightPosition.y, lightPosition.z);
     shader.setUniform1f("MaterialThickness", materialThickness);
     shader.setUniform3f("ExtinctionCoefficient", extinctionCoefficient.x, extinctionCoefficient.y, extinctionCoefficient.z);
     shader.setUniform4f("LightColor", lightColor.x, lightColor.y, lightColor.z, 1.0);
     shader.setUniform4f("BaseColor", baseColor.x, baseColor.y, baseColor.z, 1.0);
     shader.setUniform4f("SpecColor", specularColor.y, specularColor.y, specularColor.z, 1.0 );
     shader.setUniform1f("SpecPower", specular);
     shader.setUniform1f("RimScalar", rimScale);
     shader.setUniform1f("AttenuationOffset", attenuationOffset);
     
     texturedQuad(0, 0, writeFbo.getWidth(), writeFbo.getHeight());
     
     shader.end();
     writeFbo.end();
 }
开发者ID:0401morita,项目名称:ofxPostProcessing,代码行数:22,代码来源:FakeSSSPass.cpp

示例4: draw

		void draw() {
			ofBackground(25);

			fbo.begin();
			ofClear(0,0,0,0);
			ofEnableDepthTest();
			camera.begin();
			    glPushMatrix();

			    glEnable(GL_BLEND);
		        glBlendFunc(GL_SRC_ALPHA, GL_ONE);
		        glEnable(GL_ALPHA_TEST);
		        glAlphaFunc(GL_GREATER, 0);

		        if(dvel) draw_velocity();
		        if(dden){
                        draw_density();
                }

                glDisable(GL_BLEND);
		        glDisable(GL_ALPHA_TEST);

		        glPopMatrix();
                if( drawAxis ){	ofDrawAxis(15); }

			camera.end();
			ofDisableDepthTest();
			fbo.end();

            shader.begin();
            shader.setUniformTexture("tex",fbo.getTextureReference(),0);
            shader.setUniform2f("resolution",dw,dh);
            shader.setUniform1f("timer",ofGetElapsedTimef());

            fbo.draw(0,0);

            shader.end();
			gui.draw();
		}
开发者ID:kashimAstro,项目名称:3DFlare,代码行数:39,代码来源:main.cpp

示例5: drawPanels

//--------------------------------------------------------------
void testApp::drawPanels(ofFbo fbo) {
	glPushMatrix();	
	glTranslatef(0, 0, 0);
	
    ofTexture &t = fbo.getTextureReference();
    ofPoint c;
    
	t.bind();	
	glBegin(GL_QUADS);    

    int ow = OUTPUT_SCREEN_W/3;
    int oh = OUTPUT_SCREEN_H;
    
    int iw = FBO_W/5;
    int ih = FBO_H;
    
    // --------------------------------------------
    // PANEL 1 
    
    // left / top
    c = t.getCoordFromPoint(0, 0);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(0, 0);    
    // right / top
    c = t.getCoordFromPoint(iw, 0);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow, 0);    
    // right / bottom
    c = t.getCoordFromPoint(iw, ih);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow, oh);
    // left / bottom
    c = t.getCoordFromPoint(0, ih);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(0, oh);        

    // --------------------------------------------
    // PANEL 2
    
    // left / top    
    c = t.getCoordFromPoint(iw*2, 0);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow, 0);    
    // right / top
    c = t.getCoordFromPoint(iw*3, 0);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow*2, 0);    
    // right / bottom
    c = t.getCoordFromPoint(iw*3, ih);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow*2, oh);        
    // left / bottom
    c = t.getCoordFromPoint(iw*2, ih);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow, oh);        

    // --------------------------------------------
    // PANEL 3
    
    // left / top    
    c = t.getCoordFromPoint(iw*4, 0);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow*2, 0);    
    // right / top
    c = t.getCoordFromPoint(iw*5, 0);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow*3, 0);    
    // right / bottom
    c = t.getCoordFromPoint(iw*5, ih);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow*3, oh);
    // left / bottom
    c = t.getCoordFromPoint(iw*4, ih);
	glTexCoord2f(c.x, c.y); 
    glVertex2f(ow*2, oh);        

    glEnd();
	t.unbind();
	glPopMatrix();

}
开发者ID:ituita,项目名称:ituita-outdoor,代码行数:82,代码来源:testApp.cpp

示例6: draw

    void draw() {
        ofBackground(0);
        
        ofPushMatrix();
        ofPushStyle();
        
        float scaleFactor = ofGetHeight() / (float) MAX(1, video.getHeight());
        ofScale(scaleFactor, scaleFactor);
        ofTranslate(0, -verticalOffset);
        
        float totalStability = ofClamp(ofMap(smoothedMotionValue, motionMin, motionMax, 0, stability), 0, 1);
        
        int n = contours.size();
        
        for(int i = 0; i < n; i++) {
            cv::Rect cur = contours.getBoundingRect(i);
            float w = cur.width, h = cur.height;
            float sx = cur.x, sy = cur.y;
            
            buffer.begin();
            ofDisableBlendMode();
            
            // clear buffer area
            ofClear(0, 0);
            
            // draw filled shape (could blur here)
            ofPushMatrix();
            ofSetColor(255);
            ofFill();
            ofBeginShape();
            vector<cv::Point>& vertices = contours.getContour(i);
            for(int j = 0; j < vertices.size(); j++) {
                ofVertex(vertices[j].x, vertices[j].y);
            }
            ofEndShape();
            ofPopMatrix();
            
            // draw body image
            ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
            ofSetColor(255);
            video.getTexture().drawSubsection(sx, sy, w, h, sx, sy);
            buffer.end();
            
            ofEnableBlendMode(OF_BLENDMODE_ALPHA);
            ofPushMatrix();
            
            ofVec2f center = toOf(contours.getCenter(i));
            ofVec2f offset = center - bodyCenter;
            float orientation = atan2f(offset.y, offset.x);
            float spread = totalStability * spreadAmplitude;
            ofVec2f position = bodyCenter + offset + ofVec2f(offset.x, 0) * spread;
            
            float id = orientation; //contours.getLabel(i) % 3;
            
            float baseRotation = rotationRate * ofGetElapsedTimef() + id;
            float rotation = ofLerp(sin(baseRotation), ofSignedNoise(baseRotation), rotationNoise);
            rotation *= rotationAmplitude * totalStability;
            
            float baseScale = scaleRate * ofGetElapsedTimef() + id;
            float scale = 1 + scaleAmplitude * ofLerp(sin(baseScale), ofSignedNoise(baseScale), scaleNoise) * totalStability;
            
            ofPushStyle();
            ofSetColor(tintRed, tintGreen, tintBlue);
            ofTranslate(position);
            for(int j = 0; j < repetitionSteps; j++) {
                ofPushMatrix();
                float rotationAmount = ofMap(j, -1, repetitionSteps, 0, rotation);
                ofRotate(rotationAmount);
//                ofVec3f axis(0, 0, 1);
//                ofRotate(rotationAmount, axis.x, axis.y, axis.z);
                float curScale = ofMap(j, -1, repetitionSteps, 1, scale);
                ofScale(curScale, curScale, curScale);
                buffer.getTextureReference().drawSubsection(-w / 2, -h / 2, 0, w, h, sx, sy);
                ofPopMatrix();
            }
            ofPopStyle();
            
            if(debug) {
                ofDrawBitmapStringHighlight(ofToString(contours.getLabel(i)), 0, 0);
            }
            ofPopMatrix();
        }
            
        ofPopStyle();
        ofPopMatrix();
        
        ofEnableAlphaBlending();
        
        if(debug) {
            ofPushStyle();
            ofSetColor(255);
            ofNoFill();
            ofSetLineWidth(2);
            ofDrawRectangle(0, 0, video.getWidth(), video.getHeight());
            video.draw(0, 0);
            ofPopStyle();
            
            ofPushStyle();
            ofEnableBlendMode(OF_BLENDMODE_ADD);
            
//.........这里部分代码省略.........
开发者ID:GlocalSound,项目名称:Transcranial,代码行数:101,代码来源:main.cpp

示例7:

	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


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