new ofxCocoa (was ofxMacOSX)

Wow, crazy. Good to know. I wonder why the difference is so big?

It could be options used when initializing pixelformat, it could be unnecessary context locks and unlocks, most importantly, outputting across multiple monitors (on a single graphics card) is complicated if you want to enable vsync because the monitors are not synced (at least on Mac, at least on ATI). Outputting across multiple monitors on multiple GPUs is even more complicated as I’m sure you’ve found out :stuck_out_tongue:

Yeah, if I’ve learned anything recently it’s jut that there isn’t a single answer for many of these questions about multiple monitors. Most of it is very application, configuration, OS, resolution, and graphics card dependent.

If it’s something regarding the pixel format or locks/unlocks could that be integrated back into OF? Or is it something that would have to be substituted at the GLUT level/does it mean we would have to switch to a more open window management system where we could control these things?

I’m just amazed that you’re getting 2x the performance, and the core reason is that GLUT doesn’t like OSX as much as Cocoa does :slight_smile:

Yeah, if I’ve learned anything recently it’s jut that there isn’t a single answer for many of these questions about multiple monitors. Most of it is very application, configuration, OS, resolution, and graphics card dependent.

I’d be very interested to hear what you’ve learnt. It’s so annoying that as soon as you stretch your output across multiple monitors, and if you want to to be vsynced, you either have to have the outputs genlocked, or handle each output as a separate context (and then i guess you have context switching overheads).

we would have to switch to a more open window management system where we could control these things?

we already have, thats how ofxCocoa (and ofxiPhone) works :slight_smile:
http://www.mail-archive.com/osg-users@l-…-08289.html

Hi Hi ! :smiley:
So happy to check this!! and I can’t wait to try it but I don’t have right now enough hardware to try it (multiple-screens fullscreen)

I would like to setup a special fullscreen window mode, fullscreen starting from second window to the last window ( this let me do grabscreen from the first one to the app).

I thought to do simplewindow witout window border, starting on second window, I guess ofxCocoa will help me so much to setup it.

It could be…

  
goFullscreen(screen(2));  //Or another cool fullScreen system?  
or   
// setting the window position to the second screen  
ofSetWindowPosition(secondScreen, 0);  
// stretch window to cover screen until #lastScreen  
setWindowRect(rectForScreen(#lastScreen));   
// no borders at inisettings   
initSettings.windowStyle			= NSBorderlessWindowMask;  
  

I guess there is a bug at exiting cocoa window (using the red cross).
_ Transparent mode works on fullscreen mode ON and fullScreen and initSettings are correctly setup on together_

  
  
	// to go fullscreen across all windows:  
	initSettings.windowStyle			= NSBorderlessWindowMask;  
	initSettings.initRect				= MSA::ofxCocoa::rectForAllScreens();  
  

Amazing functionalities, thanks for share it

Cheers

Hi, yea there are two ways of going fullscreen exactly like you said. The official snow leopard way of using the official cocoa fullscreen methods: goFullscreen(screen(2));. Or making a borderless window cover the rect of the screen: setWindowRect(rectForScreen(#lastScreen)); (you don’t need ofSetWindowPosition because the rect includes that information). THe first method is the official and recommended way of doing it, however I"ve heard there can be weird performance bugs with it. It may just be a bug with the current opengl driver or current version of the OS. Also using the official fullscreen method you cannot go fullscreen on more than one monitor, for that you need to use the setWindowRect(). I think this API can be improved to be simpler, but at the moment I think it is flexible enough to allow you to do whatever you want to do. E.g. if you have 3 monitors and you want to go fullscreen on the last two you can write setWindowRect(NSMakeRect(rectForScreen(1).origin.x, 0, rectForScreen(1).size.width + rectForScreen(2).size.width, rectForScreen(1).size.height)); (assuming the monitors are laid side by side and have the same height, if they are not then a bit more logic can be added to detect the layout).

Yea i hadn’t realize the red cross close bug, will look into it.

ok thanks, I’ve got the way.

Would be nice write at the readme the issue ofDataPath-with-cocoa.

string newPath = [[NSString stringWithFormat:@"%@/…/data/", [[NSBundle mainBundle] bundlePath]] cString];

// change the location where the data folder rests
ofSetDataPathRoot(newPath);

Is there something that has to be diferent with mouse and poco events?

x2 framerate performace! NICEE! :twisted:

Hello everyone ! I made a really simple app with ofxCocoa and ofxARToolkit. But I have a big problem.
When I hit the Run or Build and Run button, my app compiles correctly, but when I double click it. It crashes.
I want to make a Stand alone App without using the DATA folder. The strange thing is that it actually works and compiles, but outside Xcode it doesn’t.

I really don’t understand what’s going on!

By the way I understood how to send messages form Cocoa to testApp, but I don’t understand how to make it backwards.

Thanks a lot!

here is my code http://visualindustry.com.ar/MLab/OF/Augmented-Reality-Cocoa.zip

congrats memo, this is a fantastic addon.
can see myself integrating it into all my future projects.

L.

thanks this looks very exciting.

i was able to compile and run “demo” but “basic demo” gave me the following errors.
any ideas what i am doing wrong? thanks, stephan.

  
"_glutKeyboardUpFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutGet", referenced from:  
      ofAppGlutWindow::getScreenSize()       in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::getScreenSize()       in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::getWindowPosition()       in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::getWindowPosition()       in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::display()      in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::display()      in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutReshapeWindow", referenced from:  
      ofAppGlutWindow::setWindowShape(int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::display()      in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutSetCursor", referenced from:  
      ofAppGlutWindow::showCursor()       in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::hideCursor()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutSpecialFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutKeyboardFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutSwapBuffers", referenced from:  
      ofAppGlutWindow::display()      in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutCreateWindow", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutIdleFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutPassiveMotionFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutInit", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutDisplayFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutPostRedisplay", referenced from:  
      ofAppGlutWindow::idle_cb()      in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutMouseFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o  
  "_glutGameModeString", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutSpecialUpFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutMotionFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutMainLoop", referenced from:  
      ofAppGlutWindow::runAppViaInfiniteLoop(ofBaseApp*)       in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutInitDisplayString", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutSetWindowTitle", referenced from:  
      ofAppGlutWindow::setWindowTitle(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutFullScreen", referenced from:  
      ofAppGlutWindow::display()      in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutEnterGameMode", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutInitWindowSize", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutInitDisplayMode", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutGameModeGet", referenced from:  
      ofAppGlutWindow::setupOpenGL(int, int, int)in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutPositionWindow", referenced from:  
      ofAppGlutWindow::setWindowPosition(int, int)in openFrameworks.a(ofAppGlutWindow.o)  
      ofAppGlutWindow::display()      in openFrameworks.a(ofAppGlutWindow.o)  
  "_glutReshapeFunc", referenced from:  
      ofAppGlutWindow::initializeWindow()       in openFrameworks.a(ofAppGlutWindow.o)  
ld: symbol(s) not found  
collect2: ld returned 1 exit status  

did you try the xcode project that I supplied? or just dragged the addon into your existing project? It would be easier if you try the project i supplied.

actually it looks like you probably are using my project? I had removed the glut framework from the ofxCocoa project as it is not needed. but for some reason it is being needed, so if you just re-add the framework, it should link.

thanks that did the trick.

so basic demo uses GLUT and demo uses Cocoa to draw the windows?

do both still have the speed increase you saw?

thanks,
stephan.

so working further with it , i am now trying to use some FBO code of mine.

I am using the ofxFBOTexture version that has Josh Nimoy’s supportCheck();

It compilis fine but when trying to run it i get errors:

Program received signal: “EXC_BAD_ACCESS”
and it points me to this line in ofxFBOTexture

extensions = glGetString(GL_EXTENSIONS);

When commenting out supportCheck the error does not appear but also the FBO drawing does not work.

Any ideas.

Thanks again.
Stephan.

Hi !
Is there any success using poco events such us mouse Events in ofxSimpleGuiToo? Doesn’t work for me and Im a bit lose how to resolve this

OK I added the GLut framework, and now it doesn’t crashes, but the AR is not working :roll:

Memo it seem that you have to add Glut to ofxCocoa to run well.

Thanks all lot for this addon

I figured out, how to make it work. The problem was solved when I added de GLut Framework. NO crashes any more.
But by the other hand a big problem is the DataPath issue

I solved that putting

string newPath = [[NSString stringWithFormat:@"%@/Contents/Resources", [[NSBundle mainBundle] bundlePath]] cString];

// change the location where the data folder rests
ofSetDataPathRoot(newPath);

But this works

  
 if( !tracker->init( "/Users/hypercube/AR/LogitechPro4000.dat", "/Users/hypercube/AR/markerboard_480-499.cfg", 1.0f, 1000.0f) )  

and this doesn’t

  
if( !tracker->init( LogitechPro4000.dat", "markerboard_480-499.cfg", 1.0f, 1000.0f) )            // load std. ARToolKit camera file  

and this is the way it has to be

  
 tracker->init(<#const char *nCamParamFile#>, <#const char *nMultiFile#>, <#ARFloat nNearClip#>, <#ARFloat nFarClip#>, <#ARToolKitPlus *nLogger#>)  

Any help please

No more need for help, now everything work 100%.
Those awful errors are still there.
I’ll fix them later.

So i solved the problem I had with ofxCocoa and FBO.

Someone had a similar problem with an iPhone app
http://forum.openframeworks.cc/t/ofx-061-gt;-iphone-3.2:-need-fbos-solved/4372/7

basically i needed to declare a heap-based FBO

.h
ofxFBOTexture *fboP;

.mm
fboP = new ofxFBOTexture();
fboP->allocate(ofGetWidth(), ofGetHeight(), GL_RGBA);
fboP->clear(0, 0, 0, 0);

The next thing i have to figure out is how to enable mouse events.
I am using ofxSimpleGuiToo but now I am not able to move any of the sliders etc. ?

s.