Same texture has different size depending on which window it is used

Hello, I am building an application that has 2 windows, an editor and the main application that contains some visuals tuned by the editor. This is the main.cpp file to be clear

#include "ofMain.h"
#include "ofApp.h"
#include "Editor.h"

int main( ){    
    ofGLFWWindowSettings settings;
    settings.setGLVersion(3, 2);

    // Main GUI
    settings.setSize(700, 700);
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = true;
    shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);
    shared_ptr<Editor> editor(new Editor);

    // App.
    settings.setSize(1400, 700);
    settings.setPosition(ofVec2f(300,0));
    settings.resizable = true;
    settings.shareContextWith = guiWindow; // this allows to read the texture generated in the editor
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);
    shared_ptr<ofApp> mainApp(new ofApp);

    mainApp->editor = editor;

    ofRunApp(guiWindow, editor);
    ofRunApp(mainWindow, mainApp);
    ofRunMainLoop();
}

The Editor class, is generating the texture for a cube map. The App class, read that texture and draw it to the screen.
Editor.h

#pragma once

#include "ofMain.h"
#include "TextureManager.h"

class Editor: public ofBaseApp {
public:
    void setup();
    void update();
    void draw();
    // ...
    TextureManager textureManager;
};

TextureManager.cpp

void TextureManager::setup(){
    int width = 100;
    int deep = 100;
    int height = 100;
    ofDisableArbTex();
    finalFbo.allocate(width*2+deep*2, deep*2+height);
    finalFbo.begin();
    ofClear(255, 255, 255, 0);
    finalFbo.end();
}

void TextureManager::update(){
}

void TextureManager::draw(){
    float side = 100;
    finalFbo.begin();
    ofClear(255, 255, 255, 0);
    ofPushStyle();
    if(drawFront){
        ofSetColor(ofFloatColor::cyan);
        ofDrawRectangle(deep*2 + width,
                        deep, width, height);
    }
    if(drawLeft){
        ofSetColor(ofFloatColor::red);
        ofDrawRectangle(0, deep, deep, height);
    }
    if(drawRight){
        ofSetColor(ofFloatColor::fuchsia);
        ofDrawRectangle(deep+width, deep, deep, height);
    }
    if(drawBack){
        ofSetColor(ofFloatColor::yellow);
        ofDrawRectangle(deep, deep, width, height);
    }
    if(drawTop){
        ofSetColor(ofFloatColor::darkBlue);
        ofDrawRectangle(deep, 0, width, deep);
    }
    if(drawBottom){
        ofSetColor(ofFloatColor::green);
        ofDrawRectangle(deep, width+height, width, deep);
    }
    ofPopStyle();

    finalFbo.end();
    finalFbo.getTexture().draw(0,0);
};

App.cpp

#include "ofApp.h"

void ofApp::update(){
    editor->textureManager.update();
}

void ofApp::draw(){
    ofDrawBitmapString(ofGetFrameRate(),10,10,0);
    editor->textureManager.finalFbo.getTexture().draw(0,0);
}

It works, as you in this picture where the window with the black background is the editor, and the gray one is the app.

But as soon as I move the generation of the texture in the TextureManager from the draw method to the update method, like:

void TextureManager::update(){
    finalFbo.begin();
    ofClear(255, 255, 255, 0);
    ofPushStyle();
    if(drawFront){
        ofSetColor(ofFloatColor::cyan);
        ofDrawRectangle(deep*2 + width,
                        deep, width, height);
    }
    if(drawLeft){
        ofSetColor(ofFloatColor::red);
        ofDrawRectangle(0, deep, deep, height);
    }
    if(drawRight){
        ofSetColor(ofFloatColor::fuchsia);
        ofDrawRectangle(deep+width, deep, deep, height);
    }
    if(drawBack){
        ofSetColor(ofFloatColor::yellow);
        ofDrawRectangle(deep, deep, width, height);
    }
    if(drawTop){
        ofSetColor(ofFloatColor::darkBlue);
        ofDrawRectangle(deep, 0, width, deep);
    }
    if(drawBottom){
        ofSetColor(ofFloatColor::green);
        ofDrawRectangle(deep, width+height, width, deep);
    }
    ofPopStyle();
    finalFbo.end();
};

void TextureManager::draw(){
    finalFbo.getTexture().draw(0,0);
};

the texture in the main App it it does not have the correct size, proportion and orientation. It look like this

It happens on Mac and Linux, I am using of 0.10. Does anyone have a clue about what’s going on?

OF sets the drawing matrices and viewport before calling draw so if you do draw calls in update they might not get the correct settings. if you want to do draw calls in update you can just set those manually, in this case i think it’s just the viewport but calling ofSetupPerspective should call everything for you

But then, why is it displaying the texture correctly in the editor, on the black background? Anyway, I have tried to add ofSetupScreenPerspective() at the beginning of the update method, like:

void TextureManager::update(){
    ofSetupScreenPerspective();
    //... all the rest
}

And the result does not change. I have tried to use other method instead of that one, like ofSetupScreen and ofSetupGraphicDefaults() but the error persists.

can you try calling ofViewport(0,0,finalFbo.width(), finalFbo.height()) right after finalFbo.begin()?

If I call:

void TextureManager::update(){
    finalFbo.begin();
    ofViewport(0,0,finalFbo.getWidth(), finalFbo.getHeight());
    //...
}

I do not see nothing at all.

But, without the line ofViewport(0,0,finalFbo.getWidth(), finalFbo.getHeight()); changing the dimension of the window with the mouse affect the proportions of the texture.