Skip to main content

Posts

Showing posts with the label OpenGL

How to get the camera parameters from OpenGLperspective/modelview matrix? (2)

Get camera parameters from the OpenGL modelview matrix OpenGL modelview matrix includes model related operations, therefore, the scene was scaled, translated, or rotated, these effects are also in there. There is no way to separate these operation from the pure camera parameters from the matrix only. Here we assume the model operation is identity. If your renderer separated the model operations and camera parameters, you need to undo the model operation with your implementation dependent way. Our renderer has separation of them, so we needed to undo the effect. The elements of OpenGL modelview matrix is the following. If you want to know the details of the each element, please refer my other blog (http://shitohichiumaya.blogspot.de/2011/01/what-matrix-glulookat-generates-1.html) \begin{eqnarray*}  \left[   \begin{array}{cccc}    x_x & y_x & z_x & 0 \\    x_y & y_y & z_y & 0 \\    x_z & y_z & z_z & 0...

How to get the camera parameters from OpenGLperspective/modelview matrix? (1)

Abstract This is a computer graphics and programming story. While ago, I wrote about a matrix that is generated by a OpenGL function, gluLookat. ( http://shitohichiumaya.blogspot.de/2011/01/what-matrix-glulookat-generates-1.html ) Why did I write that story? Because I was developing a renderer that is independent from the OpenGL, but some point, I need to overlay OpenGL generated image and our renderer's image. I think not a lot of people need to write a own renderer, therefore, this blog entry maybe not so much refereed. However, there are quite a lot of people visited this page. I don't know what kind of people visiting this pages, I am a bit surprised. This time, our customer has a special system and they need to compute the inverse of the OpenGL functions. Their input is OpenGL's Projection/Modelview matrix and the output is camera parameters. This is more special cases, but, the problem itself may be interested in. Introduction There are interesting visualization ...