Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ofFBO + ofCamera = unwanted offset #651

Closed
toxin20 opened this Issue · 6 comments

4 participants

@toxin20

If you use those these two together the 3d objects get an unwanted offset

code:

void testApp::draw()
{

    cam.begin();
        ofPushMatrix();
            ofSetColor(255,255,255);
            ofBox(200);
        ofPopMatrix();
    cam.end();


    fbo.begin();
    cam.begin();

            ofClear(0);
            ofPushMatrix();
                ofSetColor(0,0,0);
                ofBox(200);
            ofPopMatrix();

    cam.end();
    fbo.end();


    glPushMatrix();
        //ofTranslate(0,6,0);  <--- now i'm using something like this to "repair" it
        ofSetColor(255,255,255,255);
        glScalef(1,-1,1);
        fbo.draw(0,- ofGetHeight());
    glPopMatrix();



}

Normally the two boxes should overlap completely, instead it looks like this:

screen1
screen2

@arturoc
Owner

is this with easycam or normal camera? are you using a fbo of the size of the screen? if so drawing the fbo after the box drawn directly to the screen should only show the fbo one.

i'm using this and the boxes overlap exactly:

fbo.begin();
cam.begin();

        ofClear(0,0,0);
        ofPushMatrix();
            ofSetColor(255,0,0,30);
            ofBox(200);
        ofPopMatrix();

cam.end();
fbo.end();


glPushMatrix();
    //ofTranslate(0,6,0);  <--- now i'm using something like this to "repair" it
    ofSetColor(255,255,255,255);
    glScalef(1,-1,1);
    fbo.draw(0,- ofGetHeight());
glPopMatrix();

cam.begin();
    ofPushMatrix();
        ofSetColor(0,0,255,30);
        ofBox(200);
    ofPopMatrix();
cam.end();
@toxin20

with easycam:

setup()

ofBackground(50);
ofEnableAlphaBlending();
fbo.allocate(ofGetWidth(),ofGetHeight(), GL_RGBA,0 );

draw()

fbo.begin();
    cam.begin();

    ofClear(0,0,0);
    ofPushMatrix();
    ofSetColor(255,0,0);
    ofBox(200);
    ofPopMatrix();

    cam.end();
    fbo.end();


    glPushMatrix();
    //ofTranslate(0,6,0);  <--- now i'm using something like this to "repair" it
    ofSetColor(255,255,255);
    glScalef(1,-1,1);
    fbo.draw(0,- ofGetHeight());
    glPopMatrix();

    cam.begin();
    ofPushMatrix();
    ofSetColor(0,0,255);
    ofBox(200);
    ofPopMatrix();
    cam.end();

result:

1

with ofcamera:

setup()

ofBackground(50);
ofEnableAlphaBlending();
fbo.allocate(ofGetWidth(),ofGetHeight(), GL_RGBA,0 );

update()

cam.orbit(90, 0, 400, ofVec3f(0,0,0));

draw()

fbo.begin();
    cam.begin();

    ofClear(0,0,0);
    ofPushMatrix();
    ofSetColor(255,0,0);
    ofBox(200);
    ofPopMatrix();

    cam.end();
    fbo.end();


    glPushMatrix();
    //ofTranslate(0,6,0);  <--- now i'm using something like this to "repair" it
    ofSetColor(255,255,255);
    glScalef(1,-1,1);
    fbo.draw(0,- ofGetHeight());
    glPopMatrix();

    cam.begin();
    ofPushMatrix();
    ofSetColor(0,0,255);
    ofBox(200);
    ofPopMatrix();
    cam.end();

result:

2

@arturoc
Owner
@toxin20

i just pulled the master from github and the issue stays the same :(.

my specs:
OSX 10.6.7
Macbook Pro 13" (Early 2011)
8 GB RAM

using xcode 4 if that makes any difference. if you need some more specific infos i would be happy to provide them

@pizthewiz
Collaborator

Like @arturoc, both the ofEasyCam and ofCamera variants work for me on OS X 10.10 DP6 - @toxin20 could you try and reproduce with OF-0.8.3?

@bilderbuchi
Owner

This issue is from 2011, I think there were quite a few changes to the camera systems in between. I'm going to close this, and we can easily reopen if the OP still sees the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.