Open thomasgeissl opened 8 years ago
I am having problems getting ofxFontStash to work in a multi-window setup. It works fine, if i only use one window. Am i doing something wrong?
Here is a little example:
#include "ofMain.h" #include "ofxFontStash.h" #define TWO_WINDOWS class ofApp : public ofBaseApp{ public: void setup(){ ofSetFrameRate(60); _font.loadFont("OpenSans-CondLight.ttf", 100); } void draw(){ _font.draw("lorem ipsum", 100, 100, 100); ofDrawRectangle(ofGetWidth()/3, ofGetHeight()/3, ofGetWidth()/3, ofGetHeight()/3); } ofxFontStash _font; }; int main(){ #ifndef TWO_WINDOWS ofSetupOpenGL(1024, 768, OF_WINDOW); // <-------- setup the GL context ofRunApp(new ofApp); #endif #ifdef TWO_WINDOWS ofGLFWWindowSettings mainWindowSettings; mainWindowSettings.setGLVersion(3, 2); mainWindowSettings.windowMode = OF_WINDOW; mainWindowSettings.monitor = 0; auto mainWindow = ofCreateWindow(mainWindowSettings); ofGLFWWindowSettings secondWindowSettings; secondWindowSettings.setGLVersion(3, 2); secondWindowSettings.windowMode = OF_WINDOW; secondWindowSettings.monitor = 0; secondWindowSettings.shareContextWith = mainWindow; auto secondWindow = ofCreateWindow(secondWindowSettings); auto mainAppPtr = std::make_shared <ofApp>(); auto secondAppPtr = std::make_shared <ofApp>(); ofRunApp(mainWindow, mainAppPtr); ofRunApp(secondWindow, secondAppPtr); ofRunMainLoop(); #endif }
Here is the link to the original post in the oF forum. https://forum.openframeworks.cc/t/ofxfontstash-in-a-multi-window-setup/24417
Thomas
I am having problems getting ofxFontStash to work in a multi-window setup. It works fine, if i only use one window. Am i doing something wrong?
Here is a little example:
Here is the link to the original post in the oF forum. https://forum.openframeworks.cc/t/ofxfontstash-in-a-multi-window-setup/24417
Thomas