[vtkusers] How to get the vtk equivalents of OpenGL projection matrix?
Xianwang Wang
wangxiangtang at yahoo.com
Mon Mar 6 15:37:40 EST 2006
Dear all,
Using VTK with the following code, I can get the same modelview matrix as OpenGL¡¯s, but the projection matrix.
The projection matrix got from VTK:
1.944445 0.000000 0.000000 0.000000
0.000000 -2.592594 0.000000 0.000000
0.000000 0.000000 -1.040816 -1.000000
0.000000 0.000000 -40.816326 0.000000
The projection matrix got from OpenGL:
1.9444455063180441 0.00000000000000000 0.00000000000000000 0.00000000000000000
0.00000000000000000 2.5925940084240588 0.00000000000000000 0.00000000000000000
0.00000000000000000 0.00000000000000000 -1020.0000000000000 -20000.000000000000
0.00000000000000000 0.00000000000000000 -1.0000000000000000 0.00000000000000000
Here is my code:
vtkOpenGLCamera* cam = (vtkOpenGLCamera*)ren1->GetActiveCamera();
cam->SetPosition(110.955,100.0,73.0);
cam->SetFocalPoint(-67.1446,126.404,-17.5055);
cam->SetViewAngle(42.184658);
cam->SetViewUp(0.0,0.0,1.0);
cam->SetClippingRange(20.0, 1000.0);
cam->ComputeViewPlaneNormal();
vtkMatrix4x4* v = cam->GetViewTransformMatrix();
vtkMatrix4x4* v1 = cam->GetPerspectiveTransformMatrix(640.0/480,20.0,1000.0);
Could someone give me some suggestion about this problem? Really appreciate that!
Ivan Wang
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060306/429850d4/attachment.htm>
More information about the vtkusers
mailing list