[vtkusers] set image as background
David Gobbi
david.gobbi at gmail.com
Thu Feb 11 11:40:08 EST 2010
Hi Giancarlo,
Get out your pencil & paper and draw diagrams. Do a google image
search on "view frustum" to see the kind of diagrams that I mean
(though I always just draw them in 2D and use a trapezoid to represent
the frustum).
Also, even though VTK does a pretty good job of automatically setting
the camera parameters, it's a good exercise to set up the camera and
clipping range yourself every so often to remind yourself of how
everything works. I even do so myself fairly often, because sometimes
I forget how all this stuff fits together. By properly setting up the
camera, you can get the image to the size that you want.
David
On Thu, Feb 11, 2010 at 9:37 AM, Giancarlo Amati
<ilferraresebono at hotmail.it> wrote:
> Thanks guys that's roughly what I wanted to get to.
> althought he image should fill in the window viewport. :) instead of staying
> right there
>
> Many thanks!!!
>
>> From: david.gobbi at gmail.com
>> Date: Thu, 11 Feb 2010 09:24:39 -0700
>> Subject: Re: [vtkusers] set image as background
>> To: ilferraresebono at hotmail.it
>> CC: daviddoria+vtk at gmail.com; vtkusers at vtk.org
>>
>> I don't think that it is enough to just set up the layers, because by
>> default the Renderer will always erase everything and set the
>> background color.
>>
>> Try renderer->EraseOff() on all but the rear-most renderer.
>>
>> Note that EraseOff will also keep the depth buffer from being cleared
>> between renders, so you will have to manually set the camera position
>> and camera clipping planes in your background renderer so that the
>> image is just barely in front of the rear clipping plane.
>>
>> David
>>
>>
>> On Thu, Feb 11, 2010 at 9:20 AM, Giancarlo Amati
>> <ilferraresebono at hotmail.it> wrote:
>> > Yup, it's roughly the same structure my code has.
>> > But apparently whatever is the order or the AddRenderer..... the one
>> > containing the image seems prevailing over the other one
>> >
>> > Many thanks anyway!
>> >
>> >
>> > ________________________________
>> > Date: Thu, 11 Feb 2010 11:08:50 -0500
>> > From: daviddoria+vtk at gmail.com
>> > CC: vtkusers at vtk.org
>> > Subject: Re: [vtkusers] set image as background
>> >
>> > On Thu, Feb 11, 2010 at 10:54 AM, Giancarlo Amati
>> > <ilferraresebono at hotmail.it> wrote:
>> >
>> > mmm now it get confusing because that's the style of my code:
>> >
>> > this is the declaration:
>> > vtkSmartPointer<vtkRenderer> L0=
>> > vtkSmartPointer<vtkRenderer>::New();
>> > vtkSmartPointer<vtkCamera> camL0 = vtkCamera::New();
>> >
>> >
>> > vtkSmartPointer<vtkRenderer> L1 =
>> > vtkSmartPointer<vtkRenderer>::New();
>> > vtkSmartPointer<vtkCamera> camL1 = vtkCamera::New();
>> >
>> >
>> > vtkSmartPointer<vtkRenderWindow> renderWindow =
>> > vtkSmartPointer<vtkRenderWindow>::New();
>> > renderWindow->SetSize(720,576);
>> >
>> >
>> > Than I create a plane with texture the image I load up and then... I add
>> > the
>> > plane to L1;
>> > L0->AddActor(Scene);
>> > L1->AddActor(texturedPlane);
>> >
>> > renderWindow->AddRenderer(L0);
>> > renderWindow->AddRenderer(L1);
>> >
>> > and I call start() of the interactor.
>> >
>> > but I just got my Texture rendered..but not the 3D Model. so what u mean
>> > with Layers?
>> >
>> > Regards.
>> > Giancarlo
>> >
>> > I tried to make a demo of this:
>> > http://www.vtk.org/Wiki/VTK/Examples/BackgroundImage
>> > However, it seems like one renderer covers up the other. For now it is
>> > just
>> > trying to display an ImageActor in backgroundRenderer and then a sphere
>> > in
>> > sceneRenderer.
>> > Thanks,
>> >
>> > David
>
> ________________________________
> Troppe caselle di posta? Gestiscile da Hotmail!
More information about the vtkusers
mailing list