Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

How to separate windows and use one as renderer

$
0
0

@Julian_Puppo wrote:

I know this may be a very silly questión.

But, i don’t seem to crack it out

So´ive been checking the multiWindowOneAppExample wich uses a ofxGui to pass the values from one window to the other. The problem is that i don´t want to use GUI EVENTS, i want to use an event to know when the renderer that i´ve been using has change, or just use a window to display an FBO and other to use my own Gui system.

This is my code so far in my main.cpp that is where the different windows are defined:

#include "ofMain.h"
#include "ofApp.h"
//========================================================================
int main( ){
	

	//GUI WINDOW
	ofGLFWWindowSettings settings;
	settings.setSize(600, 600);
	settings.setPosition(ofVec2f(300, 300));
	//settings.resizable = true;
	shared_ptr<ofAppBaseWindow> renderwindow = ofCreateWindow(settings);

	//RENDER WINDOW
	settings.setSize(800, 1200);
	settings.setPosition(ofVec2f(-1500, 300));

	settings.shareContextWith = renderwindow;
	shared_ptr<ofAppBaseWindow> GuiWindow = ofCreateWindow(settings);

	shared_ptr<ofApp> mainApp(new ofApp);
	shared_ptr<ofApp> mainApp2(new ofApp);
	
	mainApp2->iswindow1 = true;

	//ofAddListener(&ofApp::notifyactiverender, mainApp.get(), &ofApp::drawRender2);

	ofRunApp(renderwindow, mainApp);
	ofRunApp(GuiWindow, mainApp2);
	ofRunMainLoop();
}

Im using the variable iswindow1 to decide wich one is a window and wich one is not. So in one window i get the renderer and in the other my customized gui.

The problem for me comes when i´ve tryed to used the function :

ofAddListener(&ofApp::notifyactiverender, mainApp.get(), &ofApp::drawRender2);

I just want to comunicate to the other window when the FBO that i choose has change, but i don´t seem to be able to link ofApp events or what so ever. Or even, if i could, how could tell the second window to change my fbo ?

i´ve tryed making my own events and then link them to the other window but i failed on doing it, just can´t hit the syntax on how to do it right.

Any help is greatly apreciatted.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles