You can get the projection transform matrix and the view transform matrix from vtkCamera as a 4x4 matrix. see GetProjectionTransformMatrix(..) and GetViewTransformMatrix(..). The actual matrix pushed onto the GL_PROJECTION and GL_MODELVIEW stacks is the transpose of those 4x4 matrices... <br>
<br>You should dig into the code of vtkOpenGLCamera.cxx to look for correspondance with your OpenGL code, Specifically....<br><br> glMatrixMode( GL_PROJECTION);<br> if(usize && vsize)<br> {<br> matrix->DeepCopy(this->GetProjectionTransformMatrix(<br>
aspectModification*usize/vsize, -1,1));<br> matrix->Transpose();<br> }<br> ...<br> glLoadMatrixd(matrix->Element[0]);<br><br> ...<br> glMatrixMode(GL_MODELVIEW);<br> glPushMatrix();<br>
matrix->DeepCopy(this->GetViewTransformMatrix());<br> matrix->Transpose();<br> glMultMatrixd(matrix->Element[0]);<br><br><br>--<br>karthik<br><br><div class="gmail_quote">On Tue, Feb 22, 2011 at 7:35 AM, Sergio Aguirre <span dir="ltr"><<a href="mailto:sergio.aguirre@gmail.com">sergio.aguirre@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi everyone, <div><br></div><div>I am attempting to implement some specific PROJECTION and VIEW matrices. </div>
<div><br></div><div>Reviewing the vtkCamera class documentation you can call getProjectionTransformMatrix, however, this returns a vtkPerspectiveTransform class object (vtkTransform for the VIEW matrix). </div>
<div><br></div><div>When debugging single step on a simple example (<a href="http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Tutorial/Step4/Cxx/Cone4.cxx;h=d6ae8f5a4cd3e0b19328effea5d97883d369efe4;hb=HEAD" target="_blank">http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Tutorial/Step4/Cxx/Cone4.cxx;h=d6ae8f5a4cd3e0b19328effea5d97883d369efe4;hb=HEAD</a>) I was only able to notice the vtkPerspectiveTransform objects but not their matrices... </div>
<div><br></div><div>Can anyone suggest how I could interrogate the final PROJECTION and VIEW matrix just before the render is actually done? </div><div><br></div><div>I'd like to make sure I am setting up everything correctly to some OpenGL code I have. </div>
<div><br></div><div>Hope you can help, </div><div><br><font color="#888888">Sergio </font></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>