21 ClassImp(TGLPlotCamera);
 
   26 TGLPlotCamera::TGLPlotCamera() :
 
   27    fZoom(1.), fShift(1.5), fCenter(),
 
   39 void TGLPlotCamera::SetViewport(
const TGLRect &vp)
 
   41    if (vp.Width() != fViewport.Width() || vp.Height() != fViewport.Height() ||
 
   42        vp.X() != fViewport.X() || vp.Y() != fViewport.Y())
 
   45       fArcBall.SetBounds(vp.Width(), vp.Height());
 
   55 void TGLPlotCamera::SetViewVolume(
const TGLVertex3* )
 
   71 void TGLPlotCamera::StartRotation(Int_t px, Int_t py)
 
   73    fArcBall.Click(TPoint(px, py));
 
   79 void TGLPlotCamera::RotateCamera(Int_t px, Int_t py)
 
   81    fArcBall.Drag(TPoint(px, py));
 
   87 void TGLPlotCamera::StartPan(Int_t px, Int_t py)
 
   90    fMousePos.fY = fViewport.Height() - py;
 
   96 void TGLPlotCamera::Pan(Int_t px, Int_t py)
 
   98    py = fViewport.Height() - py;
 
  101    Double_t mv[16] = {0.};
 
  102    glGetDoublev(GL_MODELVIEW_MATRIX, mv);
 
  103    Double_t pr[16] = {0.};
 
  104    glGetDoublev(GL_PROJECTION_MATRIX, pr);
 
  105    Int_t vp[] = {0, 0, fViewport.Width(), fViewport.Height()};
 
  107    TGLVertex3 start, end;
 
  108    gluUnProject(fMousePos.fX, fMousePos.fY, 1., mv, pr, vp, &start.X(), &start.Y(), &start.Z());
 
  109    gluUnProject(px, py, 1., mv, pr, vp, &end.X(), &end.Y(), &end.Z());
 
  110    fTruck += (start - end) /= 2.;
 
  119 void TGLPlotCamera::SetCamera()
const 
  121    glViewport(fViewport.X(), fViewport.Y(), fViewport.Width(), fViewport.Height());
 
  123    glMatrixMode(GL_PROJECTION);
 
  126            -fOrthoBox[0] * fZoom,
 
  127             fOrthoBox[0] * fZoom,
 
  128            -fOrthoBox[1] * fZoom,
 
  129             fOrthoBox[1] * fZoom,
 
  134    glMatrixMode(GL_MODELVIEW);
 
  141 void TGLPlotCamera::Apply(Double_t phi, Double_t theta)
const 
  143    glTranslated(0., 0., -fShift);
 
  144    glMultMatrixd(fArcBall.GetRotMatrix());
 
  145    glRotated(theta - 90., 1., 0., 0.);
 
  146    glRotated(phi, 0., 0., 1.);
 
  147    glTranslated(-fTruck[0], -fTruck[1], -fTruck[2]);
 
  154 Int_t TGLPlotCamera::GetX()
const 
  156    return fViewport.X();
 
  162 Int_t TGLPlotCamera::GetY()
const 
  164    return fViewport.Y();
 
  170 Int_t TGLPlotCamera::GetWidth()
const 
  172    return Int_t(fViewport.Width());
 
  178 Int_t TGLPlotCamera::GetHeight()
const 
  180    return Int_t(fViewport.Height());
 
  186 void TGLPlotCamera::ZoomIn()
 
  194 void TGLPlotCamera::ZoomOut()