Camera Opengl to OSG or with MatrixTransfrom #1198
-
Hello all I have some questions. I want to transmit the camera of my opengl scene to my OSG scene, to do this I retrieve the view of my camera as well as the point it is looking at with the following code: {
// I retrieve the camera and the center of the screen (for the point it is looking)
} but i don't know why, i have wrong values with osg eye Y axis. Does anyone have any ideas ?? If I'm not mistaken the OpenGL coordinate system is : Y up, X right, Z forward but I don't have this configuration on my OSG scene. Maybe this is the problem ? Or I have to use Matrix Transform and rotate the matrix to have the same coordinate system of my OpenGL scène ?? So can I set matrixtransform with my camera and set it to my viewer ?? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I would have thought you could just the complete projection and modelview matrices from the GL side and assign them to the osg::Camera's view and projection martrices. |
Beta Was this translation helpful? Give feedback.
-
You don't need to go through the LookAt functions, the matrices can be applied directly. FYI, the Camera::setViewMatrix(matrix) sets the matrix directly, the Camera::setViewMatrixAsLookAt(..) generates the matrix based on the gluLookAt convention and then calls Camera::setViewMatrix. |
Beta Was this translation helpful? Give feedback.
You don't need to go through the LookAt functions, the matrices can be applied directly.
FYI, the Camera::setViewMatrix(matrix) sets the matrix directly, the Camera::setViewMatrixAsLookAt(..) generates the matrix based on the gluLookAt convention and then calls Camera::setViewMatrix.