Get pointer to ofAppGLFWWindow in OF 0.9

I’m trying to get a reference to NSWindow to add a webView.

On OF 0.8.4 I was doing this:

ofAppGLFWWindow glfwWindow = *(ofAppGLFWWindow*) ofGetWindowPtr(); //error here
window = (NSWindow *)glfwWindow.getCocoaWindow();

But on the current master branch now I’m getting this error:

Calling a private constructor of class 'ofAppGLFWWindow'

I wasn’t able to figure out a work around. Hopefully someone can help. Thanks!

that way you are making a copy, don’t remember now why i made that constructor public but in any case making a copy of the window like that is not correct. you should get a pointer or a reference:

ofAppGLFWWindow * glfwWindow = (ofAppGLFWWindow*) ofGetWindowPtr(); //error here
window = (NSWindow *)glfwWindow->getCocoaWindow();

but there’s actually a function that will do the same:

window = (NSWindow *)ofGetCocoaWindow();

Oh! That was easy ^^

I get the pointers to certain extend. After that I still don’t really understand its syntax.

Thanks again!

Hi! Is there a similar function in Windows?



HWND window = ofGetWin32Window();

gives you the handler for the window, and

HGLRC wglContext = ofGetWGLContext();

the context