There was a bug in TransformGL for perspective matrix.

The function worked as intended only if near == focal.
This commit is contained in:
Federico Ponchio 2008-11-21 17:22:58 +00:00
parent 992a808685
commit 6d2363d10a
1 changed files with 10 additions and 2 deletions

View File

@ -147,8 +147,16 @@ static void GetFrustum(vcg::Camera<S> & intrinsics, S & sx,S & dx,S & bt,S & tp,
/// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane
static void TransformGL(vcg::Camera<S> & camera, S nearDist, S farDist )
{
S sx,dx,bt,tp,nr,fr;
camera.GetFrustum(sx,dx,bt,tp,nr);
S sx,dx,bt,tp,nr;
camera.GetFrustum(sx,dx,bt,tp,nr);
if(camera.cameraType == vcg::PERSPECTIVE) {
S ratio = nearDist/nr;
sx *= ratio;
dx *= ratio;
bt *= ratio;
tp *= ratio;
}
assert(glGetError()==0);