[vtkusers] Re: CocoaWindow.h/mm incomplete

Scott Harris scottrharris at gmail.com
Mon Dec 12 14:35:15 EST 2005


Did you ever come up with a bare bones Xcode project that uses Cocoa
and VTK? It would be super-useful to see a Cocoa Xcode project that
opens up a window and display a cone or something simple like that.

I tried to build the start of of Cocoa/VTK app last night by following
what was in this thread.
I dragged a custom view into my window and set its custom class to
vtkCocoaGLView and then I added libvtk-Rendering,Common,Graphics.a to
my projects. It links and runs, but I get a complaint in the log that
it can't find vtkCocoaGLView in the Nib so it defaults to a plain
NSView.

I've done a lot of VTK work with Python and wxWindows, but I'm just
getting going with Cocoa on the Mac so there are a lot of holes in my
understanding including how libraries get linked with Cocoa apps. I'm
unsure if I should be using dylibs or static libraries. Is dragging a
.h file into interface builder and linking with a .a file enough for
Cocoa to hook everything up properly? Apparently not.

Any help would be appreciated!

-Scott

On 11/25/05, Sean McBride <sean at rogue-research.com> wrote:
> On 2005-11-25 14:35, Mike Jackson said:
>
> >OK. I got the IB stuff hooked up, but now when trying to reuse my
> >code from the VTK4 days I am getting some compile errors. Now the
> >errors are pretty self explanatory. What I am not quite getting is
> >just how the "real" mac world is creating a VTK App.
> >Are you subclassing vtkCocoaGLView to add in things like setting the
> >Interactor Style?
>
> hmmm, it's been a while since I've looked at that code... let's see... I
> subclassed vtkCocoaGLView and added this method:
>
> - (void)finalInit
> {
>         ren = vtkRenderer::New();
>         renWin = vtkRenderWindow::New();
>         renWinInt = vtkRenderWindowInteractor::New();
>
>         renWin->SetWindowId([self window]);
>         renWin->SetDisplayId(self);
>
>         renWin->AddRenderer(ren);
>         renWinInt->SetRenderWindow(renWin);
>
>  [self setVTKRenderWindow:(vtkCocoaRenderWindow*)renWin];
>
>         renWinInt->Initialize();
> }
>
> Then in my NSDocument subclass's windowControllerDidLoadNib I call
> [theVTKView finalInit].  The above code is very important, and is needed
> to set everything up.
>
> I hope this info clears things up.  Maybe next week I'll create a simple
> sample Xcode project to share with everyone.
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list