[vtkusers] Re: vtkusers Digest, Vol 38, Issue 3

L.J. van Ruijven L.J.vanRuijven at amc.uva.nl
Mon Jun 4 02:35:09 EDT 2007


Hi Dov,

I advise you check carefully if there are no conversions from 32 bit 
values/pointers to 64 bit values/pointers. Almost all problems in the 
past were related to these conversions.
For example, in your code the pointer void* hwnd is a 32bit pointer 
when compiling for 32bit platform, and it is a 64bit pointer when 
compiling for the 64bit platform. I don't know the function this-
>Handle.ToPointer)), not what it returns. But if it returns a 32bit 
value on the 64bit platform, this values is automatically converted to 
a 64bit value before it is assigned to hwnd. These conversions almost 
always deliver invalid pointers.

success, Leo


> Hi,
> 
> I'm a vtk beginner, trying to embed vtk image in my viewport.
> 
> My code is something like this:
> 
> 
>        this->renWin = vtkRenderWindow::New();
>        this->iren = vtkRenderWindowInteractor::New();
>        this->ren = vtkRenderer::New();
> ...
> 
> 
>        this->renWin->AddRenderer(this->ren);
> 
>        // setup the parent window
>        void* hwnd = (this->Handle.ToPointer());   // (the class 
> is a .NET 
> UserControl)
>        this->renWin->SetParentId(hwnd);
>        this->iren->SetRenderWindow(this->renWin); 
> 
> 
>        // initialize
>        this->iren->Initialize();
>        this->ren->ResetCamera();
> 
> 
> When working 32bit, this works perfect.
> 
> When working 64bit, an empty black window is created, named 
> "Form1" 
> (instead of the name I gave it).
> 
> When I comment out the lines (64bit)
>        //void* hwnd = (this->Handle.ToPointer());
>        //this->renWin->SetParentId(hwnd);
> a new window with the correct name appears with the correct actor, 
> but the 
> "Form1" window appears as well.
> Since I plan to embed the viewport in a large application, I need 
> the 
> image to be in my existing viewport.
> 
> Does anyone have a suggestion what could make only the 64bit build 
> to fail 
> to embed the image in my viewport?
> 
> Thanks,
> Dov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ljvanruijven.vcf
Type: text/x-vcard
Size: 262 bytes
Desc: Card for "L.J. van Ruijven" <L.J.vanRuijven at amc.uva.nl>
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070604/7e1a6883/attachment.vcf>


More information about the vtkusers mailing list