Is it possible to make this with ofxFenster ?

Hi, i was thinking if its posible to make the following with ofxFenster:

  • Having multiples windows of the the same opengl app , but each window with different camera perspective

  • Having multiples windows of the the same app but only appears the gui in the first one.

how can i make this?Is it possible to make this with ofxFenster? if not which other options do i have?

thanks!

A.

Hi

Both of them are doable with ofxFenster.

For the multiple camera you could do something like this:

  
  
class testApp:public ofxFensterListener(){  
   void draw(ofxFenster* window){  
        if(window->id == 0)  
              //setup the first camera  
        if(window->id == 1)  
              //setup the second camera  
  
        // draw your scene  
   }  
}  
  

To have the gui only on the first window

  
class testApp:public ofxFensterListener(){  
   void draw(ofxFenster* window){  
        // draw your scene  
          
        if(ofxFensterManager::get()->getPrimaryWindow() == window)  
             //draw your gui  
   }  
}  

cheers.ph

that works fine.
Thanks Underdoeg.

The confusing thing with this that the code below only works if the ofxfenster (global) pointer declared in your project is win.
I mean the argument of the draw function is not a variable of type pointer of ofxfenster, it’s the pointer to use.

I don’t really understand how this can works (i’m a beginner with c++) but it is.
I saw that there is a
virtual void draw(ofxFenster* f)
in the ofxFensterListener class. I guess it the reason.

Anyway, congratulations of this addon.

  
void testApp::draw(ofxFenster* win)  
{   ofSetColor(255);  
    ofFill();  
    if (win->id == 1) ofCircle(20, 20, 20);  
    if (win->id == 2){  
	ofTranslate(-ofGetWindowPositionX(), -ofGetWindowPositionY());  
	bgImage.draw(0, 0);  
    }  
}