Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

ofFbo + ofEasyCam issues with mouse interaction

$
0
0

@mikecj184 wrote:

Hello!! :slight_smile:

I'm currently using ofEasyCam inside ofFbo. I'm using an ofFbo of 1920x1080 and mouse interactions work well on screen of same size or smaller. But, when I run the same application on MacBook with retina display - 2560x1600(Higher resolution), mouse Interactions are taken for 1920x1080.

I have a simple example demonstrating the same below. Is there a work around for this without increasing the resolution of ofFbo?

main.cpp

int main( ){
    ofSetupOpenGL(1024,768,OF_WINDOW);
    ofRunApp(new ofApp());
}

ofApp.h

ofEasyCam cam;
ofFbo fbo;

ofApp.cpp

void ofApp::setup(){
     ofSetVerticalSync(true);
     ofEnableDepthTest();
     cam.setDistance(100);
     ofSetCircleResolution(64);

     fbo.allocate(ofGetWidth()/2, ofGetHeight()/2, GL_RGBA);
     fbo.begin();
     ofClear(0,0,0,0);
     fbo.end();
}

void ofApp::draw(){

     ofBackground(0,255,0);

     fbo.begin();
     ofClear(0,0,0,0);

     cam.begin();
     ofRotateX(ofRadToDeg(.5));
     ofRotateY(ofRadToDeg(-.5));

     ofBackground(0);

     ofSetColor(255,0,0);
     ofFill();
     ofDrawBox(30);
     ofNoFill();
     ofSetColor(0);
     ofDrawBox(30);

     ofPushMatrix();
     ofTranslate(0,0,20);
     ofSetColor(0,0,255);
     ofFill();
     ofDrawBox(5);
     ofNoFill();
     ofSetColor(0);
     ofDrawBox(5);
     ofPopMatrix();
     cam.end();

     fbo.end();

     ofSetColor(255);
     ofNoFill();
     ofDrawRectangle(0,0, ofGetWidth()/2.0, ofGetHeight()/2.0);
     ofDrawLine(ofGetWidth()/4.0, 0, ofGetWidth()/4.0, ofGetHeight()/2.0);
     ofDrawLine(0, ofGetHeight()/4.0, ofGetWidth()/2.0, ofGetHeight()/4.0);

     fbo.draw(0,0, ofGetWidth(), ofGetHeight());
}

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles