Mixed intrinsic and extrinsic camera parameter in OpenGL projection matrix #1484
Closed
2 tasks done
Labels
type: bug
Indicates an unexpected problem or unintended behavior
Bug Report
Environment
Expected Behavior
The OpenGL projection matrix is expected to have the following structure:
Therefore, if you print the value of
GL_PROJECTION_MATRIX
, the 16th element must be zero.Current Behavior
Currently, if you construct a
SimWindow
following the default setup, the 16th element ofGL_PROJECTION_MATRIX
is not zero. For example, when the aspect ratio is 4:3, the projection matrix is:It seems the cause of the problem is that part of extrinsic parameters (which are supposed to be included in the model-view matrix) are integrated into the projection matrix (which is supposed to only contain the intrinsic parameters):
https://github.com/dartsim/dart/blob/v6.3.0/dart/gui/Win3D.cpp#L169
This may lead to confusion if the camera parameters need to be exported and used in other programs. Although this does not expose any rendering problem, I personally suggest moving the
gluLookAt
to model-view. Kindly let me know if I'm missing any context.Code to Reproduce
dart-opengl-projection-matrix-bug-report
Steps to Reproduce
Build and run the code. The code prints the value of
GL_PROJECTION_MATRIX
when the aspect ratio is 4:3.The text was updated successfully, but these errors were encountered: