Panda3D inside Cocoa App

Hi all!

Is it possible to have Panda3D running inside a Cocoa App? Consider, for example a scene editor. It could contain a Panda3D view of the scene and a set of Cocoa views for adding objects to the scene, attaching materials to objects, etc…

Thanks

Yes, but you need a development build of Panda (not 1.8.1) to do this. You pass an NSView pointer as an integer to WindowProperties.setParentWindow, and Panda will parent its window to that view.

Sorry, but I only had the chance to try this now.

It doesn’t seem as simple as I thought it would be. Can I see some example code?

Thanks

I’m not a Cocoa developer, but (assuming you program in C++, using PandaFramework) this is roughly what the Panda side could look like:

WindowProperties props;
props.set_origin(0, 0);
props.set_size(512, 512);
props.set_parent_window((size_t)nsview_pointer);

WindowFramework *window = framework.open_window(props, GraphicsPipe::BF_require_window);