[vtkusers] Re: CocoaWindow.h/mm incomplete
Mike Jackson
maillist at bluequartz.net
Mon Nov 28 19:35:15 EST 2005
On Nov 25, 2005, at 5:07 PM, Sean McBride 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
>
Sean,
I implemented what you have above but there seems to be a problem.
In my NSDocument Subclass, PFDocument, in the
windowControllerDidLoadNib method I call:
[vtkView finalInit];
Except that vtkView is still nill at that point. Which is kinda weird
since I know the constructor has already been called so the reference
in my PFDocument must not have been set yet. Are you over riding some
other method in your NSDocument Subclass? Or maybe I am missing some
hook up in Interface builder?
If I put everything in the vtkCocoaGLView Subclass constructor then I
get a warning "invalid drawable" when _interactor->Initialize
(); is called. The warning seems to be harmless, but I would like
something that didn't produce warnings.
Maybe there is another method in vtkCocoaGLView that could be
implemented or over ridden where this stuff can be hooked up?
Thanks for any help.
---
Mike Jackson
mike _at_ bluequartz dot net
More information about the vtkusers
mailing list