本文整理汇总了C++中ofFbo::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ ofFbo::getWidth方法的具体用法?C++ ofFbo::getWidth怎么用?C++ ofFbo::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofFbo
的用法示例。
在下文中一共展示了ofFbo::getWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void testApp::process(ofFbo & fbo, ofImage & image, string name){
fbo.begin();
ofClear(0);
shader.begin();
shader.setUniformTexture("tex", cam.getTextureReference(), 0 );
shader.setUniform2f("texSize", cam.getWidth(), cam.getHeight());
shader.setUniform2f("size", fbo.getWidth(), fbo.getHeight());
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex3f(0, 0, 0);
glTexCoord2f(fbo.getWidth(), 0);
glVertex3f(fbo.getWidth(), 0, 0);
glTexCoord2f(fbo.getWidth(), fbo.getHeight());
glVertex3f(fbo.getWidth(), fbo.getHeight(), 0);
glTexCoord2f(0,fbo.getHeight());
glVertex3f(0,fbo.getHeight(), 0);
glEnd();
shader.end();
fbo.end();
TIME_SAMPLE_START(name);
fbo.readToPixels(image.getPixelsRef());
//image.update();
TIME_SAMPLE_STOP(name);
//image.draw(0, 0);
}
示例2: 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();
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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();
}
示例6: 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);
}
示例7: meshFromFbo
void CloudsVisualSystemNbody::meshFromFbo(ofFbo& fbo, ofMesh& mesh){
mesh.addTexCoord(ofVec2f(0,0));
mesh.addVertex(ofVec3f(0,0,0));
mesh.addTexCoord(ofVec2f(fbo.getWidth(),0));
mesh.addVertex(ofVec3f(fbo.getWidth(),0,0));
mesh.addTexCoord(ofVec2f(0,fbo.getHeight()));
mesh.addVertex(ofVec3f(0,fbo.getHeight(),0));
mesh.addTexCoord(ofVec2f(fbo.getWidth(),fbo.getHeight()));
mesh.addVertex(ofVec3f(fbo.getWidth(),fbo.getHeight(),0));
mesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
}
示例8:
Obj(ofFbo & videoFrame)
:pixelsChanged(false)
,createdTexPixels(false)
{
pixels.allocate(videoFrame.getWidth(),videoFrame.getHeight(),ofGetImageTypeFromGLType(videoFrame.getTextureReference().texData.glInternalFormat));
updateTexture(videoFrame);
total_num_frames++;
}
示例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();
}
示例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();
}
示例11: fit
// draw texture in fbo using aspectratio of texture, showing the complete texture, but not filling the fbo
void ftUtil::fit(ofFbo& _dst, ofTexture& _tex) {
float meRatio = float(_dst.getWidth()) / float(_dst.getHeight()); // 0.5625
float texRatio = float(_tex.getWidth()) / float(_tex.getHeight()); // 1.3333
float width, height;
float x0, y0, x1, y1;
if (meRatio > texRatio) {
height = _dst.getHeight();
width = height * texRatio;
}
else {
width = _dst.getWidth();
height = width / texRatio;
}
x0 = (_dst.getWidth() - width) / 2;
x1 = x0 + width;
y0 = (_dst.getHeight() - height) / 2;
y1 = y0 + height;
ofMesh quad;
quad.setMode(OF_PRIMITIVE_TRIANGLE_FAN);
quad.addVertex(glm::vec3(x0,y0,0));
quad.addVertex(glm::vec3(x1,y0,0));
quad.addVertex(glm::vec3(x1,y1,0));
quad.addVertex(glm::vec3(x0,y1,0));
quad.addTexCoord(glm::vec2(0,0));
quad.addTexCoord(glm::vec2(_tex.getWidth(),0));
quad.addTexCoord(glm::vec2(_tex.getWidth(),_tex.getHeight()));
quad.addTexCoord(glm::vec2(0,_tex.getHeight()));
_dst.begin();
ofClear(0,0);
_tex.bind();
quad.draw();
_tex.unbind();
_dst.end();
}
示例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);
}
示例13: initRandom
void ofApp::initRandom(ofFbo &target, int seed){
printf("init random %d\n", seed);
ofSeedRandom(seed);
ofFloatPixels newState;
int w = target.getWidth();
int h = target.getHeight();
newState.allocate(w, h, OF_PIXELS_RGB);
for(int x=0; x<w; x++){
for(int y=0; y<h; y++){
float r = ofSignedNoise(x,y,frame);
float g = ofSignedNoise(x+11111,y+11111,frame);
float b = ofSignedNoise(x+37283,y+37283,frame);
newState.setColor(x,y,ofFloatColor(r,g,b));
}
}
target.begin();
ofImage(newState).draw(0,0,w,h);
target.end();
}
示例14: 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();
}
示例15: draw
void MindPaint::draw(){
// This is for debug purpose, when the headset is not available
// usually updatebrush is called inside MindPaint::update()
if (useMouse && tgState != READY && appState == READY){
updateFoes();
updateBrush();
}
ofBackground(0);
switch (appState){
case SELECT_BG:
buffer.begin();
ofSetColor((int)back.r, (int)back.g, (int)back.b);
ofFill();
ofRect(0, 0, buffer.getWidth(), buffer.getHeight());
buffer.end();
Buffer::draw(buffer);
ofSetColor((int)mood.r, (int)mood.g, (int)mood.b, 255);
ofCircle(ofGetWidth()/2, ofGetHeight()/2, 50);
break;
case DRAW:
buffer.begin();
brush->draw();
buffer.end();
Buffer::draw(buffer);
moverControl->debugDraw();
break;
case PAUSE:
Buffer::draw(buffer);
break;
}
drawMindsetStatus(useMouse ? tgEmu.args : tg.values);
tgEmu.draw();
}