[vtkusers] Need help integrating VTK with an existing OpenGL application (translating glFrustum and gluLookAt calls to VTK)

Weiguang Guan guanw at rhpcs.mcmaster.ca
Thu Jan 3 16:50:48 EST 2008


You can calculate the values of six arguments of glFrustum from the four 
arguments of gluPerspective, and vice versa.

Weiguang

On Thu, 3 Jan 2008, Mark Waligora wrote:

> Weiguang,
>
> Thanks for the reply.  I have no problem using the vtk classes in place of
> code that I already have.  My issue is that I'm not certain how to use the
> vtkCamera in place of my glFrustum call when I am creating a frustum where,
> for example, both the left and right sides of the front face of the frustum
> volume lie on the negative side of the y axis.  From what I can tell, the
> vtkCamera can be given a viewing angle and a near and far plane, but that
> gives me the equivalent control of a gluPerspective call, which is more
> limited than the functionality that glFrustum provides.  I noticed there was
> a function to multiply in additional matrices to the camera's transformation
> matrix, but I don't think that would be quite what I want either.
>
> -Mark Waligora
>
> On Jan 3, 2008 1:08 PM, Weiguang Guan <guanw at rhpcs.mcmaster.ca> wrote:
>
>> Hi Mark,
>>
>> If you decide to move on to vtk, then you shouldn't called gl commands
>> directly. vtkCamera contains methods that implement what you want to do.
>>
>> Weiguang
>>
>> On Thu, 3 Jan 2008, Mark Waligora wrote:
>>
>>> Hey all,
>>> I've done quite a bit of searching and reading and am having some
>> trouble
>>> getting started integrating VTK into my application.  I'm a new user,
>> but
>>> I've spent enough time looking that I don't think I'm missing anything
>> too
>>> obvious.
>>>
>>> I have a fairly simple visualization application written with OpenGL.  I
>>> want to visualize some more complicated data sets, so I wanted to write
>> a
>>> version that works with VTK.
>>>
>>> My visualization application is fed in data from a motion capture
>> system, so
>>> right now, every time my application loop updates, it reads the data
>> from
>>> the mo-cap system, and updates the rendering with very specific calls to
>>> glFrustum and gluLookAt.  The front face of the frustum volume is almost
>>> never centered around the z axis, so I can't simulate the frustum
>> creation
>>> by simply providing a vtkCamera with a position, direction, and viewing
>>> angle.  I need more control of the frustum shape than that functionality
>>> seems to provide.
>>>
>>> Can anyone advise me on how to create a simple vtk application with no
>> user
>>> control where the frustum and camera position are automatically updated
>> by
>>> the program every cycle of the main program loop?  From what I can tell,
>> I
>>> don't want to use an interactor since the user will not be interacting
>> with
>>> the application (the user interacts with the motion capture system, and
>> the
>>> application simply queries data from the motion capture system when it
>> is
>>> rendering).  Again, I need to be able to create frustums that aren't
>>> centered around the z axis.
>>>
>>> Thanks in advance!
>>>
>>> -Mark Waligora
>>>
>>
>



More information about the vtkusers mailing list